if (future.isSuccess()) {
ChannelPipeline p = future.channel().pipeline();
if (p.get(HttpObjectAggregator.class) != null) {
p.remove(HttpObjectAggregator.class);
}
ChannelHandlerContext ctx = p.context(HttpRequestDecoder.class);
if (ctx == null) {
// this means the user use a HttpServerCodec
ctx = p.context(HttpServerCodec.class);
if (ctx == null) {
throw new IllegalStateException("No HttpDecoder and no HttpServerCodec in the pipeline");
}
p.addBefore(ctx.name(), "wsencoder", newWebsocketDecoder());
p.replace(ctx.name(), "wsdecoder", newWebSocketEncoder());
} else {
p.remove(HttpRequestDecoder.class);
p.remove(HttpResponseEncoder.class);
}
} else {