public void onDisconnect(IWebSocketConnection con) throws IOException { }
public void onConnect(IWebSocketConnection con) throws IOException, UnsupportedProtocolException { }
};
IWebSocketConnection webSocketConnection = httpClient.openWebSocketConnection("ws://localhost:" + port, "com.example.echo", handler);
webSocketConnection.writeMessage(new TextMessage("0123456789"));
////////////////////////////////////////////
// without handler
IWebSocketConnection webSocketConnection2 = httpClient.openWebSocketConnection("ws://localhost:" + port, "com.example.echo");
webSocketConnection2.writeMessage(new TextMessage("0123456789"));
TextMessage msg = webSocketConnection2.readTextMessage();
Assert.assertEquals("0123456789", msg.toString());
webSocketConnection2.writeMessage(new TextMessage("0123456789"));
msg = webSocketConnection2.readTextMessage();
Assert.assertEquals("0123456789", msg.toString());
webSocketConnection.close();
webSocketConnection2.close();
}