List of usage examples for io.netty.channel ChannelPipeline addLast
ChannelPipeline addLast(ChannelHandler... handlers);
From source file:com.github.mrstampy.kitchensync.netty.channel.initializer.ByteArrayMessageInitializer.java
License:Open Source License
@Override protected void initChannel(DatagramChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new ByteArrayMessageHandler()); }
From source file:com.github.mrstampy.kitchensync.netty.channel.initializer.KiSyMessageInitializer.java
License:Open Source License
@Override protected void initChannel(DatagramChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new KiSyMessageHandler()); }
From source file:com.github.mrstampy.kitchensync.netty.channel.initializer.StringMessageInitializer.java
License:Open Source License
@Override protected void initChannel(DatagramChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new StringMessageHandler()); }
From source file:com.github.mrstampy.kitchensync.test.SslInitializer.java
License:Open Source License
@Override protected void initChannel(DatagramChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new SslHandler(context.createSSLEngine())); pipeline.addLast(new KiSyMessageHandler()); }
From source file:com.github.nettybook.ch4.EchoClient.java
License:Apache License
public static void main(String[] args) throws Exception { EventLoopGroup group = new NioEventLoopGroup(); try {//from www .j ava 2 s .c o m Bootstrap b = new Bootstrap(); b.group(group).channel(NioSocketChannel.class).handler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); p.addLast(new EchoClientHandler1()); p.addLast(new LoggingHandler()); } }); ChannelFuture f = b.connect("localhost", 8888).sync(); f.channel().closeFuture().sync(); } finally { group.shutdownGracefully(); } }
From source file:com.github.nettybook.ch7.junit.TelnetServerInitializerV3.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); // Add the text line codec combination first, pipeline.addLast(new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter())); // the encoder and decoder are static as these are sharable pipeline.addLast(DECODER);/* ww w .ja v a 2s.c o m*/ pipeline.addLast(ENCODER); pipeline.addLast(new IdleStateHandler(0, 0, 10, TimeUnit.SECONDS)); // and then business logic. pipeline.addLast(SERVER_HANDLER); }
From source file:com.github.nettybook.ch8.TelnetServerInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); // Add the text line codec combination first, pipeline.addLast(new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter())); // the encoder and decoder are static as these are sharable pipeline.addLast(DECODER);/*from ww w . ja va2s. c o m*/ pipeline.addLast(ENCODER); // and then business logic. pipeline.addLast(SERVER_HANDLER); }
From source file:com.github.picto.network.exemple.HttpSnoopClientInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) { ChannelPipeline p = ch.pipeline(); // Enable HTTPS if necessary. if (sslCtx != null) { p.addLast(sslCtx.newHandler(ch.alloc())); }// w w w . j a va 2 s.co m p.addLast(new HttpClientCodec()); // Remove the following line if you don't want automatic content decompression. p.addLast(new HttpContentDecompressor()); // Uncomment the following line if you don't want to handle HttpContents. //p.addLast(new HttpObjectAggregator(1048576)); p.addLast(new HttpSnoopClientHandler(shouldEnd)); }
From source file:com.github.sinsinpub.pero.backend.ProxyChannelInitializer.java
License:Apache License
@Override protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); if (proxyHandler != null) { p.addLast(proxyHandler); }// www.j a v a 2s . c o m p.addLast(new DirectClientHandler(promise)); }
From source file:com.github.sinsinpub.pero.frontend.SocksServerInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel socketChannel) throws Exception { ChannelPipeline p = socketChannel.pipeline(); p.addLast(new SocksInitRequestDecoder()); p.addLast(new SocksMessageEncoder()); p.addLast(socksServerHandler);// www.j a v a2 s . c o m }