Search in sources :

Example 1 with HelloWorldServerHandler

use of org.ko.netty.t1.handler.HelloWorldServerHandler in project tutorials-java by Artister.

the class ServerChannelInitializer method initChannel.

@Override
protected void initChannel(SocketChannel socketChannel) throws Exception {
    ChannelPipeline pipeline = socketChannel.pipeline();
    // 字符串解码 和 编码
    pipeline.addLast("decoder", new StringDecoder());
    pipeline.addLast("encoder", new StringEncoder());
    // 自己的逻辑Handler
    pipeline.addLast("handler", new HelloWorldServerHandler());
}
Also used : StringEncoder(io.netty.handler.codec.string.StringEncoder) HelloWorldServerHandler(org.ko.netty.t1.handler.HelloWorldServerHandler) 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 HelloWorldServerHandler (org.ko.netty.t1.handler.HelloWorldServerHandler)1