// Using Netty by default:
while (true) {
AsyncHttpClient client = new AsyncHttpClient();
WebSocketListener listener = new Listener();
WebSocketUpgradeHandler handler = new WebSocketUpgradeHandler.Builder()
.addWebSocketListener(listener).build();
WebSocket socket = null;
boolean connectionSuccessful = true;
// Try to create a websocket connection
try {