/** {@inheritDoc} */ @Override public final void onFailure(Throwable t) { for (WebSocketListener listener : listeners) { if (!ok.get() && webSocket != null) { webSocket.addWebSocketListener(listener); } listener.onError(t); } }
/** {@inheritDoc} */ @Override public final WebSocket onCompleted() throws Exception { if (status != SWITCHING_PROTOCOLS) { IllegalStateException e = new IllegalStateException("Invalid Status Code " + status); for (WebSocketListener listener : listeners) { listener.onError(e); } throw e; } return webSocket; }
/** {@inheritDoc} */ @Override public final WebSocket onCompleted() throws Exception { if (status != 101) { IllegalStateException e = new IllegalStateException("Invalid Status Code " + status); for (WebSocketListener listener : listeners) { listener.onError(e); } throw e; } if (webSocket == null) { throw new NullPointerException("webSocket"); } return webSocket; }