Search in sources :

Example 26 with ChannelHandler

use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler in project reactor-netty by reactor.

the class NettyContextTest method addNonByteEncoderWhenFullReactorPipeline.

@Test
public void addNonByteEncoderWhenFullReactorPipeline() throws Exception {
    channel.pipeline().addLast(NettyPipeline.HttpCodec, new HttpServerCodec()).addLast(NettyPipeline.HttpServerHandler, new ChannelDuplexHandler()).addLast(NettyPipeline.ReactiveBridge, new ChannelHandlerAdapter() {
    });
    ChannelHandler encoder = new ChannelHandlerAdapter() {
    };
    testContext.addHandlerFirst("encoder", encoder);
    assertEquals(channel.pipeline().names(), Arrays.asList(NettyPipeline.HttpCodec, NettyPipeline.HttpServerHandler, "encoder", NettyPipeline.ReactiveBridge, "DefaultChannelPipeline$TailContext#0"));
}
Also used : ChannelHandlerAdapter(io.netty.channel.ChannelHandlerAdapter) ChannelDuplexHandler(io.netty.channel.ChannelDuplexHandler) HttpServerCodec(io.netty.handler.codec.http.HttpServerCodec) ChannelHandler(io.netty.channel.ChannelHandler) Test(org.junit.Test)

Example 27 with ChannelHandler

use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler in project reactor-netty by reactor.

the class NettyContextTest method addNonByteEncoderWhenNoRight.

@Test
public void addNonByteEncoderWhenNoRight() throws Exception {
    channel.pipeline().addLast(NettyPipeline.HttpCodec, new ChannelHandlerAdapter() {
    });
    ChannelHandler encoder = new ChannelHandlerAdapter() {
    };
    testContext.addHandlerFirst("encoder", encoder);
    assertEquals(channel.pipeline().names(), Arrays.asList(NettyPipeline.HttpCodec, "encoder", "DefaultChannelPipeline$TailContext#0"));
}
Also used : ChannelHandlerAdapter(io.netty.channel.ChannelHandlerAdapter) ChannelHandler(io.netty.channel.ChannelHandler) Test(org.junit.Test)

Example 28 with ChannelHandler

use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler in project reactor-netty by reactor.

the class NettyContextTest method addByteDecoderWhenNoRight.

@Test
public void addByteDecoderWhenNoRight() throws Exception {
    channel.pipeline().addLast(NettyPipeline.HttpCodec, new ChannelHandlerAdapter() {
    });
    ChannelHandler decoder = new LineBasedFrameDecoder(12);
    testContext.addHandlerLast("decoder", decoder).addHandlerFirst("decoder$extract", NettyPipeline.inboundHandler(ADD_EXTRACTOR));
    assertEquals(channel.pipeline().names(), Arrays.asList(NettyPipeline.HttpCodec, "decoder$extract", "decoder", "DefaultChannelPipeline$TailContext#0"));
}
Also used : ChannelHandlerAdapter(io.netty.channel.ChannelHandlerAdapter) LineBasedFrameDecoder(io.netty.handler.codec.LineBasedFrameDecoder) ChannelHandler(io.netty.channel.ChannelHandler) Test(org.junit.Test)

Example 29 with ChannelHandler

use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler in project reactor-netty by reactor.

the class NettyContextTest method addByteDecoderWhenNoLeft.

@Test
public void addByteDecoderWhenNoLeft() throws Exception {
    channel.pipeline().addLast(NettyPipeline.ReactiveBridge, new ChannelHandlerAdapter() {
    });
    ChannelHandler decoder = new LineBasedFrameDecoder(12);
    testContext.addHandlerLast("decoder", decoder).addHandlerFirst("decoder$extract", NettyPipeline.inboundHandler(ADD_EXTRACTOR));
    assertEquals(channel.pipeline().names(), Arrays.asList("decoder$extract", "decoder", NettyPipeline.ReactiveBridge, "DefaultChannelPipeline$TailContext#0"));
}
Also used : ChannelHandlerAdapter(io.netty.channel.ChannelHandlerAdapter) LineBasedFrameDecoder(io.netty.handler.codec.LineBasedFrameDecoder) ChannelHandler(io.netty.channel.ChannelHandler) Test(org.junit.Test)

Example 30 with ChannelHandler

use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler in project reactor-netty by reactor.

the class NettyContextTest method addByteEncoderWhenNoRight.

@Test
public void addByteEncoderWhenNoRight() throws Exception {
    channel.pipeline().addLast(NettyPipeline.HttpCodec, new ChannelHandlerAdapter() {
    });
    ChannelHandler encoder = new LineBasedFrameDecoder(12);
    testContext.addHandlerFirst("encoder", encoder);
    assertEquals(channel.pipeline().names(), Arrays.asList(NettyPipeline.HttpCodec, "encoder", "DefaultChannelPipeline$TailContext#0"));
}
Also used : ChannelHandlerAdapter(io.netty.channel.ChannelHandlerAdapter) LineBasedFrameDecoder(io.netty.handler.codec.LineBasedFrameDecoder) ChannelHandler(io.netty.channel.ChannelHandler) Test(org.junit.Test)

Aggregations

ChannelHandler (io.netty.channel.ChannelHandler)216 Test (org.junit.Test)88 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)44 Channel (io.netty.channel.Channel)27 ChannelPipeline (io.netty.channel.ChannelPipeline)26 SslHandler (io.netty.handler.ssl.SslHandler)25 Test (org.junit.jupiter.api.Test)24 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)23 ChannelInboundHandlerAdapter (io.netty.channel.ChannelInboundHandlerAdapter)21 FilterChainMatchingHandler (io.grpc.xds.FilterChainMatchingProtocolNegotiators.FilterChainMatchingHandler)20 ChannelFuture (io.netty.channel.ChannelFuture)20 FilterChainSelector (io.grpc.xds.FilterChainMatchingProtocolNegotiators.FilterChainMatchingHandler.FilterChainSelector)19 ChannelHandlerAdapter (io.netty.channel.ChannelHandlerAdapter)18 InetSocketAddress (java.net.InetSocketAddress)18 DownstreamTlsContext (io.grpc.xds.EnvoyServerProtoData.DownstreamTlsContext)17 FilterChain (io.grpc.xds.EnvoyServerProtoData.FilterChain)17 LineBasedFrameDecoder (io.netty.handler.codec.LineBasedFrameDecoder)16 AtomicReference (java.util.concurrent.atomic.AtomicReference)16 TcpIngester (com.wavefront.ingester.TcpIngester)15 ByteBuf (io.netty.buffer.ByteBuf)13