Search in sources :

Example 1 with CommandEncoder

use of pers.cy.iris.commons.network.protocol.CommandEncoder in project iris by chicc999.

the class NettyTransport method handler.

protected ChannelHandler handler() {
    return new ChannelInitializer() {

        @Override
        protected void initChannel(Channel ch) throws Exception {
            ch.pipeline().addLast(new LengthFieldBasedFrameDecoder(config.getFrameMaxSize(), 0, 4, 0, 4));
            ch.pipeline().addLast(new CommandDecoder());
            ch.pipeline().addLast(new CommandEncoder());
            ch.pipeline().addLast(new IdleStateHandler(0, 0, config.getChannelMaxIdleTime(), TimeUnit.MILLISECONDS));
            ch.pipeline().addLast(dispatcherHandler);
            ch.pipeline().addLast(connectionHandler);
        }
    };
}
Also used : CommandDecoder(pers.cy.iris.commons.network.protocol.CommandDecoder) IdleStateHandler(io.netty.handler.timeout.IdleStateHandler) CommandEncoder(pers.cy.iris.commons.network.protocol.CommandEncoder) LengthFieldBasedFrameDecoder(io.netty.handler.codec.LengthFieldBasedFrameDecoder)

Aggregations

LengthFieldBasedFrameDecoder (io.netty.handler.codec.LengthFieldBasedFrameDecoder)1 IdleStateHandler (io.netty.handler.timeout.IdleStateHandler)1 CommandDecoder (pers.cy.iris.commons.network.protocol.CommandDecoder)1 CommandEncoder (pers.cy.iris.commons.network.protocol.CommandEncoder)1