Skip to content

Commit b4ebd2e

Browse files
committed
Ugly way of dealing with new HttpClientCodec
1 parent 09ef5c0 commit b4ebd2e

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

client/src/main/java/org/asynchttpclient/netty/channel/ChannelManager.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,10 @@ public static boolean isSslHandlerConfigured(ChannelPipeline pipeline) {
398398
}
399399

400400
public void upgradeProtocol(ChannelPipeline pipeline, Uri requestUri) throws SSLException {
401-
if (pipeline.get(HTTP_CLIENT_CODEC) != null)
402-
pipeline.remove(HTTP_CLIENT_CODEC);
401+
if (pipeline.get("HttpClientCodec$Decoder#0") != null) {
402+
pipeline.remove("HttpClientCodec$Decoder#0");
403+
pipeline.remove("HttpClientCodec$Encoder#0");
404+
}
403405

404406
if (requestUri.isSecured())
405407
if (isSslHandlerConfigured(pipeline)) {
@@ -447,8 +449,13 @@ public Bootstrap getBootstrap(Uri uri, ProxyServer proxy) {
447449
}
448450

449451
public void upgradePipelineForWebSockets(ChannelPipeline pipeline) {
450-
pipeline.addAfter(HTTP_CLIENT_CODEC, WS_ENCODER_HANDLER, new WebSocket08FrameEncoder(true));
451-
pipeline.remove(HTTP_CLIENT_CODEC);
452+
453+
// HttpClientCodec$Decoder#0
454+
// HttpClientCodec$Encoder#0
455+
456+
pipeline.addAfter("HttpClientCodec$Encoder#0", WS_ENCODER_HANDLER, new WebSocket08FrameEncoder(true));
457+
pipeline.remove("HttpClientCodec$Decoder#0");
458+
pipeline.remove("HttpClientCodec$Encoder#0");
452459
pipeline.addBefore(AHC_WS_HANDLER, WS_DECODER_HANDLER, new WebSocket08FrameDecoder(false, false, config.getWebSocketMaxFrameSize()));
453460
pipeline.addAfter(WS_DECODER_HANDLER, WS_FRAME_AGGREGATOR, new WebSocketFrameAggregator(config.getWebSocketMaxBufferSize()));
454461
}

0 commit comments

Comments
 (0)