修复参数为ByteBuf造成的ClassCastException

master
剑器近 2021-05-25 14:13:43 +08:00
parent 831970e042
commit e0c9e1abf2
1 changed files with 4 additions and 1 deletions

View File

@ -31,6 +31,9 @@ public class MessageEncoderWrapper extends ChannelOutboundHandlerAdapter {
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
ByteBuf buf = null;
try {
if (msg instanceof ByteBuf)
buf = (ByteBuf) msg;
else
buf = encoder.encode(msg);
if (log.isInfoEnabled())
log.info("<<<<<原始报文[ip={}],hex={}", ctx.channel().remoteAddress(), ByteBufUtil.hexDump(buf));