If I run following java class, no exception or error message occures, but I'm sure that connection cannot be established (GrailsApplication1 is not running, and 'url' is not pointing to any 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, how can I recognize if connection is established? I'm newbie in client/server dev, so maybe I'm missing something obvious.
Thanks for any advice, or doc reference!
Now, I figured it out... Key is that I have to run the code as an Application, in this case javafx app. Then, if you try to transmit something (dClient send "Hi... - in this case), app tries to send a message, and you get
ConnectException: Connection refused
, if there is nothing running onurl
.This seems to me as shortest version of open-dolphin server accessibity test: