WebSocketListener l = new TextListener();
if (supportBinary) {
l = new BinaryListener(l);
}
webSocket.addWebSocketListener(l);
l.onOpen(webSocket);
}
void connectFutureException(Throwable t) {
IOException e = IOException.class.isAssignableFrom(t.getClass()) ? IOException.class.cast(t) : new IOException(t);
connectOperationFuture.ioException(e).done();