use of io.netty.handler.codec.string.StringEncoder in project camel by apache.
the class NettyHttpGetWithInvalidMessageTest method createRegistry.
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry registry = super.createRegistry();
// setup the String encoder and decoder
StringDecoder stringDecoder = new StringDecoder();
registry.bind("string-decoder", stringDecoder);
StringEncoder stringEncoder = new StringEncoder();
registry.bind("string-encoder", stringEncoder);
List<ChannelHandler> decoders = new ArrayList<ChannelHandler>();
decoders.add(stringDecoder);
List<ChannelHandler> encoders = new ArrayList<ChannelHandler>();
encoders.add(stringEncoder);
registry.bind("encoders", encoders);
registry.bind("decoders", decoders);
return registry;
}
use of io.netty.handler.codec.string.StringEncoder in project benchmark by seelunzi.
the class ClientIniter method initChannel.
@Override
protected void initChannel(SocketChannel socketChannel) throws Exception {
ChannelPipeline pipeline = socketChannel.pipeline();
pipeline.addLast("stringD", new StringDecoder());
pipeline.addLast("stringC", new StringEncoder());
pipeline.addLast("http", new HttpClientCodec());
pipeline.addLast("chat", new ChatClientHandler());
}
use of io.netty.handler.codec.string.StringEncoder in project benchmark by seelunzi.
the class ServerIniterHandler method initChannel.
@Override
protected void initChannel(SocketChannel socketChannel) throws Exception {
ChannelPipeline pipeline = socketChannel.pipeline();
pipeline.addLast("docode", new StringDecoder());
pipeline.addLast("encode", new StringEncoder());
pipeline.addLast("chat", new ChatServerHandler());
}
use of io.netty.handler.codec.string.StringEncoder in project pancm_project by xuwujing.
the class NettyClientFilter method initChannel.
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline ph = ch.pipeline();
/*
* 解码和编码,应和服务端一致
* */
// ph.addLast("framer", new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter()));
ph.addLast("decoder", new StringDecoder());
ph.addLast("encoder", new StringEncoder());
// 客户端的逻辑
ph.addLast("handler", new NettyClientHandler());
}
use of io.netty.handler.codec.string.StringEncoder in project pancm_project by xuwujing.
the class NettyServerFilter method initChannel.
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline ph = ch.pipeline();
// 以("\n")为结尾分割的 解码器
// ph.addLast("framer", new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter()));
// 解码和编码,应和客户端一致
ph.addLast("decoder", new StringDecoder());
ph.addLast("encoder", new StringEncoder());
// 服务端业务逻辑
ph.addLast("handler", new NettyServerHandler());
}
Aggregations