use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler in project LogHub by fbacchella.
the class ClientFactory method addHandlers.
@Override
public void addHandlers(ChannelConsumer<Bootstrap, Channel, SA> source) {
ChannelHandler handler = new ChannelInitializer<CC>() {
@Override
public void initChannel(CC ch) throws Exception {
try {
source.addHandlers(ch.pipeline());
} catch (Exception e) {
logger.error("Netty handler failed: {}", e.getMessage());
logger.throwing(Level.DEBUG, e);
}
}
};
bootstrap.handler(handler);
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler in project reactor-netty by reactor.
the class NettyContextTest method addByteEncoderWhenFullReactorPipeline.
@Test
public void addByteEncoderWhenFullReactorPipeline() throws Exception {
channel.pipeline().addLast(NettyPipeline.HttpCodec, new HttpServerCodec()).addLast(NettyPipeline.HttpServerHandler, new ChannelDuplexHandler()).addLast(NettyPipeline.ReactiveBridge, new ChannelHandlerAdapter() {
});
ChannelHandler encoder = new LineBasedFrameDecoder(12);
testContext.addHandlerFirst("encoder", encoder);
assertEquals(channel.pipeline().names(), Arrays.asList(NettyPipeline.HttpCodec, NettyPipeline.HttpServerHandler, "encoder", NettyPipeline.ReactiveBridge, "DefaultChannelPipeline$TailContext#0"));
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler in project reactor-netty by reactor.
the class NettyContextTest method addNonByteEncoderWhenNoLeft.
@Test
public void addNonByteEncoderWhenNoLeft() throws Exception {
channel.pipeline().addLast(NettyPipeline.ReactiveBridge, new ChannelHandlerAdapter() {
});
ChannelHandler encoder = new ChannelHandlerAdapter() {
};
testContext.addHandlerFirst("encoder", encoder);
assertEquals(channel.pipeline().names(), Arrays.asList("encoder", NettyPipeline.ReactiveBridge, "DefaultChannelPipeline$TailContext#0"));
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler in project reactor-netty by reactor.
the class NettyContextTest method addNonByteDecoderWhenNoLeft.
@Test
public void addNonByteDecoderWhenNoLeft() throws Exception {
channel.pipeline().addLast(NettyPipeline.ReactiveBridge, new ChannelHandlerAdapter() {
});
ChannelHandler decoder = new ChannelHandlerAdapter() {
};
testContext.addHandlerLast("decoder", decoder);
assertEquals(channel.pipeline().names(), Arrays.asList("decoder", NettyPipeline.ReactiveBridge, "DefaultChannelPipeline$TailContext#0"));
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler in project reactor-netty by reactor.
the class NettyContextTest method addNonByteDecoderWhenEmptyPipeline.
@Test
public void addNonByteDecoderWhenEmptyPipeline() throws Exception {
ChannelHandler decoder = new ChannelHandlerAdapter() {
};
testContext.addHandlerLast("decoder", decoder);
assertEquals(channel.pipeline().names(), Arrays.asList("decoder", "DefaultChannelPipeline$TailContext#0"));
}
Aggregations