}
@Test
public void test() throws IOException {
JsonRpcClient client = createJsonRpcClient("/reconnection");
if (client instanceof JsonRpcClientWebSocket) {
Assert.assertEquals("new",
client.sendRequest("sessiontest", String.class));
Assert.assertEquals("old",
client.sendRequest("sessiontest", String.class));
Assert.assertEquals("old",
client.sendRequest("sessiontest", String.class));
log.info("SessionId: " + client.getSession().getSessionId());
JsonRpcClientWebSocket webSocketClient = (JsonRpcClientWebSocket) client;
WebSocketSession session = webSocketClient.getWebSocketSession();
session.close();
Assert.assertEquals("old",
client.sendRequest("sessiontest", String.class));
Assert.assertEquals("old",
client.sendRequest("sessiontest", String.class));
client.setSessionId(null);
// With this we test if the transportId is used to recognize the
// session
Assert.assertEquals("old",
client.sendRequest("sessiontest", String.class));
Assert.assertEquals("old",
client.sendRequest("sessiontest", String.class));
log.info("SessionId: " + client.getSession().getSessionId());
}
client.close();
}