update decoder改名

This commit is contained in:
Guoqs
2024-11-27 09:19:41 +08:00
parent 88b8339e22
commit 9b95a07d8b
4 changed files with 280 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
package com.jsowell.netty.server.electricbicycles;
import com.jsowell.netty.decoder.StartAndLengthFieldFrameDecoder;
import com.jsowell.netty.decoder.YouDianDecoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
@@ -20,7 +20,7 @@ public class ElectricBicyclesServerChannelInitializer extends ChannelInitializer
@Override
protected void initChannel(SocketChannel channel) throws Exception {
ChannelPipeline pipeline = channel.pipeline();
pipeline.addLast("frameDecoder", new StartAndLengthFieldFrameDecoder());
pipeline.addLast("frameDecoder", new YouDianDecoder());
// pipeline.addLast("decoder", new MessageDecode());
// pipeline.addLast("encoder", new MessageEncode());
pipeline.addLast("decoder", new ByteArrayDecoder());

View File

@@ -1,6 +1,6 @@
package com.jsowell.netty.server.yunkuaichong;
import com.jsowell.netty.decoder.StartAndLengthFieldFrameDecoder;
import com.jsowell.netty.decoder.YunKuaiChongDecoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
@@ -21,7 +21,7 @@ public class NettyServerChannelInitializer extends ChannelInitializer<SocketChan
protected void initChannel(SocketChannel channel) throws Exception {
ChannelPipeline pipeline = channel.pipeline();
// pipeline.addLast("frameDecoder",new CustomDecoder());
pipeline.addLast("frameDecoder", new StartAndLengthFieldFrameDecoder());
pipeline.addLast("frameDecoder", new YunKuaiChongDecoder());
pipeline.addLast("decoder", new ByteArrayDecoder());
pipeline.addLast("encoder", new ByteArrayDecoder());
//读超时时间设置为10s0表示不监控