如果我运行以下 java 类,则不会出现异常或错误消息,但我确定无法建立连接(GrailsApplication1 未运行,并且“url”未指向任何 bean):
public class ConnectNow {
private void connect() {
ClientDolphin dClient = new ClientDolphin();
dClient.setClientModelStore(new ClientModelStore(dClient));
String url = "http://localhost:8080/GrailsApplication1/";
ClientConnector connector = new HttpClientConnector(dClient, url);
connector.setCodec(new JsonCodec());
dClient.setClientConnector(connector);
dClient.send("Hi from client");
}
public static void main(String[] args) {
ConnectNow cn = new ConnectNow();
cn.connect();
System.out.println("End");
}
}
Soo,我如何识别是否建立了连接?我是客户端/服务器开发的新手,所以也许我遗漏了一些明显的东西。
感谢您的任何建议或文档参考!