// Fool the decoder mapping
return s;
}
}).transport(transport());
final Socket socket = client.create();
socket.on("message", new Function<String>() {
@Override
public void on(String t) {
//System.out.println("=>" + t);
b.get().append(t);
flatch.countDown();
}
}).on(Event.CLOSE, new Function<String>() {
@Override
public void on(String t) {
b.get().append(t);
}
}).on(Event.REOPENED, new Function<String>() {
@Override
public void on(String t) {
b.get().append(t);
try {
socket.fire("PONG");
} catch (IOException e) {
e.printStackTrace();
}
latch.countDown();
}
}).on(new Function<IOException>() {
@Override
public void on(IOException ioe) {
ioe.printStackTrace();
b.get().append("ERROR");
elatch.countDown();
}
}).on(Event.OPEN, new Function<String>() {
@Override
public void on(String t) {
b.get().append(t);
}
}).open(clientRequest.build());
socket.fire("PING");
latch.await(10, TimeUnit.SECONDS);
flatch.await(10, TimeUnit.SECONDS);
server.stop();