diff --git a/websocket/vertx/src/main/java/io/undertow/websockets/vertx/VertxWebSocketHttpExchange.java b/websocket/vertx/src/main/java/io/undertow/websockets/vertx/VertxWebSocketHttpExchange.java index 7c2e34370..5a34b53cd 100644 --- a/websocket/vertx/src/main/java/io/undertow/websockets/vertx/VertxWebSocketHttpExchange.java +++ b/websocket/vertx/src/main/java/io/undertow/websockets/vertx/VertxWebSocketHttpExchange.java @@ -15,6 +15,7 @@ package io.undertow.websockets.vertx; +import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.http.HttpHeaderNames; import io.undertow.websockets.handshake.WebSocketHttpExchange; @@ -114,6 +115,13 @@ public void setResponseHeader(final CharSequence headerName, final String header @Override public void upgradeChannel(Consumer listener) { response.headers().set(HttpHeaderNames.CONNECTION, "upgrade"); + + Http1xServerConnection connection = (Http1xServerConnection) request.connection(); + ChannelHandlerContext context = connection.channelHandlerContext(); + final ChannelHandler websocketChannelHandler = context.pipeline().get("websocketExtensionHandler"); + if (websocketChannelHandler != null) { + context.pipeline().remove(websocketChannelHandler); + } response.setStatusCode(101).end(new Handler>() { @Override public void handle(AsyncResult event) {