All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.envisioniot.sub.client.internal.netty.SubClientChannelInitializer Maven / Gradle / Ivy

There is a newer version: 3.0.3
Show newest version
package com.envisioniot.sub.client.internal.netty;

import com.envisioniot.sub.common.netty.BackingHandler;
import com.envisioniot.sub.common.netty.PbHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.timeout.IdleStateHandler;

import java.util.concurrent.TimeUnit;

/**
 * created by jie.jin on 2018/12/24.
 */
public class SubClientChannelInitializer extends ChannelInitializer {
    private boolean useSSL = false;
    
    public SubClientChannelInitializer(boolean useSSL) {
        this.useSSL = useSSL;
    }
    
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(new IdleStateHandler(120, 60, 0, TimeUnit.SECONDS));
        pipeline.addLast(new ClientEncoder());
        pipeline.addLast(new KeeperHandler());
        pipeline.addLast(new HeartbeatHandler());
        pipeline.addLast(new ClientDecoder());
        pipeline.addLast(new PbHandler());
        pipeline.addLast(new BackingHandler());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy