ChannelPipeline p = ctx.pipeline();
ChannelHandlerContext nettyDecoderCtx = p.context(WebSocketFrameDecoder.class);
p.addAfter(nettyDecoderCtx.name(), "websocket-read-metrics", new ClientReadMetricsHandler(eventsSubject));
ChannelHandlerContext nettyEncoderCtx = p.context(WebSocketFrameEncoder.class);
p.addAfter(nettyEncoderCtx.name(), "websocket-write-metrics", new ClientWriteMetricsHandler(eventsSubject));
if (messageAggregation) {
p.addAfter("websocket-read-metrics", "websocket-frame-aggregator", new WebSocketFrameAggregator(maxFramePayloadLength));
}
p.remove(HttpObjectAggregator.class);
p.remove(this);