assertNotNull(server);
server.start();
final CountDownLatch latch = new CountDownLatch(1);
final AtomicReference<POJO> response = new AtomicReference<POJO>();
Client client = ClientFactory.getDefault().newClient();
RequestBuilder request = client.newRequestBuilder()
.method(Request.METHOD.GET)
.uri(targetUrl + "/suspend")
.decoder(new Decoder<String, POJO>() {
@Override
public POJO decode(Event e, String s) {
return new POJO(s);
}
})
.transport(Request.TRANSPORT.WEBSOCKET);
Socket socket = client.create();
socket.on(Event.MESSAGE.name(), new Function<POJO>() {
@Override
public void on(POJO t) {
response.set(t);
latch.countDown();