2019-01-16 16:19:44 +08:00
|
|
|
package network.client;
|
2018-12-27 17:54:23 +08:00
|
|
|
|
|
|
|
import com.ljsd.jieling.netty.cocdex.ByteBufDecoder;
|
|
|
|
import com.ljsd.jieling.netty.cocdex.ByteBufEncoder;
|
2019-05-11 11:44:50 +08:00
|
|
|
import com.ljsd.jieling.netty.cocdex.TeaDecoder;
|
|
|
|
import com.ljsd.jieling.netty.cocdex.TeaEncoder;
|
2018-12-27 17:54:23 +08:00
|
|
|
import io.netty.channel.ChannelInitializer;
|
|
|
|
import io.netty.channel.ChannelPipeline;
|
|
|
|
import io.netty.channel.socket.SocketChannel;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by justin on 14-8-12.
|
|
|
|
*/
|
|
|
|
public class NettyTCPClientInitializer extends ChannelInitializer<SocketChannel>{
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void initChannel(SocketChannel ch) throws Exception {
|
|
|
|
|
|
|
|
ChannelPipeline p = ch.pipeline();
|
2019-05-11 11:44:50 +08:00
|
|
|
p.addLast(new TeaDecoder());
|
|
|
|
p.addLast(new TeaEncoder());
|
2018-12-27 17:54:23 +08:00
|
|
|
p.addLast(new NettyTCPClientHandler());
|
|
|
|
}
|
|
|
|
}
|