List of usage examples for io.netty.channel ChannelPipeline addFirst
ChannelPipeline addFirst(ChannelHandler... handlers);
From source file:org.wso2.extension.siddhi.io.tcp.transport.TCPNettyClient.java
License:Open Source License
public TCPNettyClient(int numberOfThreads, boolean keepAlive, boolean noDelay) { group = new NioEventLoopGroup(numberOfThreads); bootstrap = new Bootstrap(); bootstrap.group(group).channel(NioSocketChannel.class).option(ChannelOption.SO_KEEPALIVE, keepAlive) .option(ChannelOption.TCP_NODELAY, noDelay).handler(new ChannelInitializer<SocketChannel>() { @Override//from w w w . j ava 2s. c om protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addFirst(new MessageEncoder()); } }); }