lizhanwei
2020-02-17 ee16db5e1cbc1c27bdbc1984567b5e61a3d005dd
im_lib/src/main/java/com/anyun/im_lib/netty/NettyTcpClient.java
@@ -12,6 +12,7 @@
import com.anyun.im_lib.listener.IMSConnectStatusCallback;
import com.anyun.im_lib.listener.OnEventListener;
import com.anyun.im_lib.util.ByteUtil;
import com.safeluck.aykj.utils.BytesUtils;
import java.nio.ByteBuffer;
import java.util.Vector;
@@ -218,14 +219,14 @@
                    imsConnectStatusCallback.onConnected();
                }
                // TODO: 2019/12/12  连接成功 ,发送握手消息(需要的话——)
                try {
                    ByteBuf byteBuf = ByteBufAllocator.DEFAULT.ioBuffer();
                    byteBuf.writeBytes(mOnEventListener.getRegisterMessage());
                    Log.i(TAG, "发送消息: "+ ByteUtil.byte2HexStr(mOnEventListener.getRegisterMessage()));
                    channel.writeAndFlush(byteBuf);
                } catch (Exception e) {
                    Log.i(TAG, "发送消息失败,reason="+e.getMessage()+"\t");
                }
//                try {
//                    ByteBuf byteBuf = ByteBufAllocator.DEFAULT.ioBuffer();
//                    byteBuf.writeBytes(mOnEventListener.getRegisterMessage());
//                    Log.i(TAG, "发送消息: "+ ByteUtil.byte2HexStr(mOnEventListener.getRegisterMessage()));
//                    channel.writeAndFlush(byteBuf);
//                } catch (Exception e) {
//                    Log.i(TAG, "发送消息失败,reason="+e.getMessage()+"\t");
//                }
                break;
            case IMSConfig.CONNECT_STATE_FAILURE:
                default:
@@ -331,6 +332,7 @@
            Log.i(TAG, "sendMsg fail,channel为空"+msg);
        }
        try {
            Log.i(TAG, "sendMsg: "+ BytesUtils.bytesToHexString(msg));
            ByteBuf byteBuf = ByteBufAllocator.DEFAULT.ioBuffer();
            byteBuf.writeBytes(msg);
            channel.writeAndFlush(byteBuf);