List of usage examples for io.netty.handler.codec LengthFieldBasedFrameDecoder LengthFieldBasedFrameDecoder
public LengthFieldBasedFrameDecoder(int maxFrameLength, int lengthFieldOffset, int lengthFieldLength, int lengthAdjustment, int initialBytesToStrip, boolean failFast)
From source file:com.github.pgasync.impl.netty.NettyPgProtocolStream.java
License:Apache License
ChannelInitializer<Channel> newProtocolInitializer(ChannelHandler onActive) { return new ChannelInitializer<Channel>() { @Override/*from ww w . j a v a2 s.com*/ protected void initChannel(Channel channel) throws Exception { if (useSsl) { channel.pipeline().addLast(newSslInitiator()); } channel.pipeline().addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 1, 4, -4, 0, true)); channel.pipeline().addLast(new ByteBufMessageDecoder()); channel.pipeline().addLast(new ByteBufMessageEncoder()); channel.pipeline().addLast(newProtocolHandler()); channel.pipeline().addLast(onActive); } }; }