add LengthFieldBasedFrameDecoder
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-02-08 23:05:31 +08:00
parent dbb95dd999
commit 9d72433199
5 changed files with 14 additions and 18 deletions

View File

@@ -92,7 +92,7 @@ public abstract class AbstractClient implements Client {
logger.debug("write {} to channel", sdkProto);
byte[] bytes = NettyUtil.toBytes(sdkProto);
MyProtocolBean myProtocolBean = new MyProtocolBean((byte)0xA, (byte)0xC, bytes.length, bytes);
MyProtocolBean myProtocolBean = new MyProtocolBean((byte) 0xA, (byte) 0xC, bytes.length, bytes);
channel.writeAndFlush(myProtocolBean).addListener((ChannelFutureListener) channelFuture -> {
if (channelFuture.isSuccess()) {
//发送成功后立即跳出
@@ -138,7 +138,7 @@ public abstract class AbstractClient implements Client {
logger.debug("write {} to channel", sdkProto);
byte[] bytes = NettyUtil.toBytes(sdkProto);
MyProtocolBean myProtocolBean = new MyProtocolBean((byte)0xA, (byte)0xC, bytes.length, bytes);
MyProtocolBean myProtocolBean = new MyProtocolBean((byte) 0xA, (byte) 0xC, bytes.length, bytes);
channelFuture.channel().writeAndFlush(myProtocolBean).addListener(channelFuture -> {
if (channelFuture.isSuccess()) {
return;

View File

@@ -1,10 +1,10 @@
package io.github.ehlxr.did.client;
import io.github.ehlxr.did.netty.MyProtocolDecoder;
import io.github.ehlxr.did.netty.MyProtocolEncoder;
import io.github.ehlxr.did.client.handler.SdkClientHandler;
import io.github.ehlxr.did.common.Constants;
import io.github.ehlxr.did.common.Try;
import io.github.ehlxr.did.netty.MyProtocolDecoder;
import io.github.ehlxr.did.netty.MyProtocolEncoder;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;