Search in sources :

Example 1 with NulsMessageDecoder

use of io.nuls.network.netty.conn.serialization.NulsMessageDecoder in project nuls by nuls-io.

the class NulsChannelInitializer method initChannel.

@Override
protected void initChannel(SocketChannel socketChannel) throws Exception {
    ChannelPipeline p = socketChannel.pipeline();
    p.addLast("idle", new IdleStateHandler(READ_IDEL_TIME_OUT, WRITE_IDEL_TIME_OUT, ALL_IDEL_TIME_OUT, TimeUnit.SECONDS));
    // p.addLast("decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, MAX_FRAME_LENGTH, 4, 4, 6, 0, true));
    // p.addLast("encoder0", new LengthFieldPrepender(8, false));
    p.addLast("decoder", new NulsMessageDecoder());
    p.addLast("encoder0", new NulsMessageEncoder());
    p.addLast("heartbeat", new HeartbeatServerHandler());
    p.addLast(t);
}
Also used : NulsMessageDecoder(io.nuls.network.netty.conn.serialization.NulsMessageDecoder) IdleStateHandler(io.netty.handler.timeout.IdleStateHandler) ChannelPipeline(io.netty.channel.ChannelPipeline) NulsMessageEncoder(io.nuls.network.netty.conn.serialization.NulsMessageEncoder) HeartbeatServerHandler(io.nuls.network.netty.conn.handler.HeartbeatServerHandler)

Aggregations

ChannelPipeline (io.netty.channel.ChannelPipeline)1 IdleStateHandler (io.netty.handler.timeout.IdleStateHandler)1 HeartbeatServerHandler (io.nuls.network.netty.conn.handler.HeartbeatServerHandler)1 NulsMessageDecoder (io.nuls.network.netty.conn.serialization.NulsMessageDecoder)1 NulsMessageEncoder (io.nuls.network.netty.conn.serialization.NulsMessageEncoder)1