com.github.houbbbbb.sso.nt.initiallizer.ClientChannelInitializer Maven / Gradle / Ivy
The newest version!
package com.github.houbbbbb.sso.nt.initiallizer;
import com.github.houbbbbb.sso.nt.factory.ItemType;
import com.github.houbbbbb.sso.nt.factory.StaticFactory;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
/**
* @author: hbw
* @date: 2020/7/7
**/
public class ClientChannelInitializer extends ChannelInitializer {
@Override
protected void initChannel(SocketChannel channel) throws Exception {
try {
channel.pipeline().addLast(StaticFactory.getEncoder(ItemType.STRING_ENCODER));
channel.pipeline().addLast(StaticFactory.getDecoder(ItemType.LINE_BASED_DECODER));
channel.pipeline().addLast(StaticFactory.getDecoder(ItemType.STRING_DECODER));
channel.pipeline().addLast(StaticFactory.getClientHandler(ItemType.HEARTBEAT_CLIENT_HANDLER));
} catch (Exception e){ e.printStackTrace(); }
}
}