diff --git a/client/src/main/java/org/asynchttpclient/netty/handler/WebSocketHandler.java b/client/src/main/java/org/asynchttpclient/netty/handler/WebSocketHandler.java index 9aa16fadd6..d86b0d9b82 100755 --- a/client/src/main/java/org/asynchttpclient/netty/handler/WebSocketHandler.java +++ b/client/src/main/java/org/asynchttpclient/netty/handler/WebSocketHandler.java @@ -73,12 +73,10 @@ public UpgradeCallback(NettyResponseFuture future, Channel channel, HttpRespo // We don't need to synchronize as replacing the "ws-decoder" will // process using the same thread. private void invokeOnSucces(Channel channel, WebSocketUpgradeHandler h) { - if (!h.touchSuccess()) { - try { - h.onSuccess(new NettyWebSocket(channel, responseHeaders.getHeaders())); - } catch (Exception ex) { - logger.warn("onSuccess unexpected exception", ex); - } + try { + h.onSuccess(new NettyWebSocket(channel, responseHeaders.getHeaders())); + } catch (Exception ex) { + logger.warn("onSuccess unexpected exception", ex); } } diff --git a/client/src/main/java/org/asynchttpclient/ws/WebSocketUpgradeHandler.java b/client/src/main/java/org/asynchttpclient/ws/WebSocketUpgradeHandler.java index 81853d1351..0888f7da2a 100644 --- a/client/src/main/java/org/asynchttpclient/ws/WebSocketUpgradeHandler.java +++ b/client/src/main/java/org/asynchttpclient/ws/WebSocketUpgradeHandler.java @@ -33,7 +33,6 @@ public class WebSocketUpgradeHandler implements UpgradeHandler, Async private WebSocket webSocket; private final List listeners; private final AtomicBoolean ok = new AtomicBoolean(false); - private boolean onSuccessCalled; private int status; private List bufferedFrames; @@ -53,11 +52,6 @@ public final void onThrowable(Throwable t) { onFailure(t); } - public boolean touchSuccess() { - boolean prev = onSuccessCalled; - onSuccessCalled = true; - return prev; - } @Override public final State onBodyPartReceived(HttpResponseBodyPart bodyPart) throws Exception {