update 电单车协议

This commit is contained in:
Guoqs
2024-07-15 15:07:38 +08:00
parent ebf5259a6f
commit 61b948aea9
4 changed files with 184 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
package com.jsowell.netty.server.electricbicycles;
import com.jsowell.netty.decoder.ProtocolDnyDecoder;
import com.jsowell.netty.decoder.StartAndLengthFieldFrameDecoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
@@ -21,7 +22,7 @@ public class ElectricBicyclesServerChannelInitializer extends ChannelInitializer
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 ProtocolDnyDecoder());
pipeline.addLast("decoder", new ByteArrayDecoder());
pipeline.addLast("encoder", new ByteArrayDecoder());
//读超时时间设置为10s0表示不监控