use of io.netty.handler.codec.http.HttpServerCodec in project weicoder by wdcode.
the class WebSocketServer method handler.
@Override
protected ChannelHandler handler() {
return new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(final SocketChannel ch) throws Exception {
ch.pipeline().addLast(new HttpServerCodec());
ch.pipeline().addLast(new HttpObjectAggregator(1024 * 1024));
ch.pipeline().addLast(new WebSocketHandler("websocket"));
ch.config().setAllocator(PooledByteBufAllocator.DEFAULT);
}
};
}
use of io.netty.handler.codec.http.HttpServerCodec in project reactor-netty by reactor.
the class ConnectionTest method addByteDecoderWhenNoRight.
@Test
void addByteDecoderWhenNoRight() {
channel.pipeline().addLast(NettyPipeline.HttpCodec, new HttpServerCodec());
testContext.addHandlerLast(DECODER_NAME, decoder).addHandlerFirst(DECODER_EXTRACT_NAME, NettyPipeline.inboundHandler(ADD_EXTRACTOR));
assertThat(channel.pipeline().names()).containsExactly(NettyPipeline.HttpCodec, DECODER_EXTRACT_NAME, DECODER_NAME, TAIL_CONTEXT_NAME);
}
use of io.netty.handler.codec.http.HttpServerCodec in project reactor-netty by reactor.
the class ConnectionTest method addSeveralByteEncodersWhenCodec.
@Test
void addSeveralByteEncodersWhenCodec() {
ChannelHandler encoder1 = new LineBasedFrameDecoder(12);
ChannelHandler encoder2 = new LineBasedFrameDecoder(13);
channel.pipeline().addLast(NettyPipeline.HttpCodec, new HttpServerCodec()).addLast(NettyPipeline.HttpTrafficHandler, httpTrafficHandlerMock).addLast(NettyPipeline.ReactiveBridge, reactiveBridgeMock);
testContext.addHandlerFirst("encoder1", encoder1).addHandlerFirst("encoder2", encoder2);
assertThat(channel.pipeline().names()).containsExactly(NettyPipeline.HttpCodec, NettyPipeline.HttpTrafficHandler, "encoder2", "encoder1", NettyPipeline.ReactiveBridge, TAIL_CONTEXT_NAME);
}
use of io.netty.handler.codec.http.HttpServerCodec in project reactor-netty by reactor.
the class ConnectionTest method addNonByteEncoderWhenFullReactorPipeline.
@Test
void addNonByteEncoderWhenFullReactorPipeline() {
channel.pipeline().addLast(NettyPipeline.HttpCodec, new HttpServerCodec()).addLast(NettyPipeline.HttpTrafficHandler, httpTrafficHandlerMock).addLast(NettyPipeline.ReactiveBridge, reactiveBridgeMock);
testContext.addHandlerFirst(ENCODER_NAME, encoder);
assertThat(channel.pipeline().names()).containsExactly(NettyPipeline.HttpCodec, NettyPipeline.HttpTrafficHandler, ENCODER_NAME, NettyPipeline.ReactiveBridge, TAIL_CONTEXT_NAME);
}
use of io.netty.handler.codec.http.HttpServerCodec in project reactor-netty by reactor.
the class ConnectionTest method addByteEncoderWhenFullReactorPipeline.
@Test
void addByteEncoderWhenFullReactorPipeline() {
channel.pipeline().addLast(NettyPipeline.HttpCodec, new HttpServerCodec()).addLast(NettyPipeline.HttpTrafficHandler, httpTrafficHandlerMock).addLast(NettyPipeline.ReactiveBridge, reactiveBridgeMock);
ChannelHandler encoder = new LineBasedFrameDecoder(12);
testContext.addHandlerFirst(ENCODER_NAME, encoder);
assertThat(channel.pipeline().names()).containsExactly(NettyPipeline.HttpCodec, NettyPipeline.HttpTrafficHandler, ENCODER_NAME, NettyPipeline.ReactiveBridge, TAIL_CONTEXT_NAME);
}
Aggregations