Search in sources :

Example 1 with BaseClientHandler

use of org.ko.netty.t2.handler.BaseClientHandler in project tutorials-java by Artister.

the class ClientChannelInitializer method initChannel.

protected void initChannel(SocketChannel socketChannel) throws Exception {
    ChannelPipeline pipeline = socketChannel.pipeline();
    pipeline.addLast("decoder", new StringDecoder());
    pipeline.addLast("encoder", new StringEncoder());
    // 客户端的handler
    // 先调用handler在ChannnelActive方法中调用fireChannelActive会激活handler1
    pipeline.addLast("handler", new HwClientHandler());
    pipeline.addLast("handler1", new BaseClientHandler());
}
Also used : StringEncoder(io.netty.handler.codec.string.StringEncoder) HwClientHandler(org.ko.netty.t2.handler.HwClientHandler) BaseClientHandler(org.ko.netty.t2.handler.BaseClientHandler) StringDecoder(io.netty.handler.codec.string.StringDecoder) ChannelPipeline(io.netty.channel.ChannelPipeline)

Aggregations

ChannelPipeline (io.netty.channel.ChannelPipeline)1 StringDecoder (io.netty.handler.codec.string.StringDecoder)1 StringEncoder (io.netty.handler.codec.string.StringEncoder)1 BaseClientHandler (org.ko.netty.t2.handler.BaseClientHandler)1 HwClientHandler (org.ko.netty.t2.handler.HwClientHandler)1