diff --git a/pom.xml b/pom.xml
index d594a98..0758534 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,7 +62,7 @@
io.netty
netty-handler
- 4.1.65.Final
+ 4.1.66.Final
provided
diff --git a/src/main/java/io/github/yezhihao/netmc/codec/MessageDecoderWrapper.java b/src/main/java/io/github/yezhihao/netmc/codec/MessageDecoderWrapper.java
index 2afa06b..a43539f 100644
--- a/src/main/java/io/github/yezhihao/netmc/codec/MessageDecoderWrapper.java
+++ b/src/main/java/io/github/yezhihao/netmc/codec/MessageDecoderWrapper.java
@@ -2,6 +2,7 @@ package io.github.yezhihao.netmc.codec;
import io.github.yezhihao.netmc.session.Session;
import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufUtil;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
@@ -31,7 +32,7 @@ public class MessageDecoderWrapper extends ChannelInboundHandlerAdapter {
ctx.fireChannelRead(message);
buf.skipBytes(buf.readableBytes());
} catch (Exception e) {
- throw new DecoderException(e);
+ throw new DecoderException(ByteBufUtil.hexDump(buf), e);
} finally {
buf.release();
}
diff --git a/src/main/java/io/github/yezhihao/netmc/util/AdapterCollection.java b/src/main/java/io/github/yezhihao/netmc/util/AdapterCollection.java
new file mode 100644
index 0000000..dcf878f
--- /dev/null
+++ b/src/main/java/io/github/yezhihao/netmc/util/AdapterCollection.java
@@ -0,0 +1,50 @@
+package io.github.yezhihao.netmc.util;
+
+import java.util.AbstractCollection;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.function.Function;
+
+/**
+ * @author yezhihao
+ * home https://gitee.com/yezhihao/jt808-server
+ */
+public final class AdapterCollection extends AbstractCollection {
+
+ private final Collection src;
+ private final Iterator iterator;
+
+ public AdapterCollection(Collection src, Function function) {
+ this.src = src;
+ this.iterator = new Iterator() {
+
+ private final Function f = function;
+ private final Iterator it = src.iterator();
+
+ @Override
+ public boolean hasNext() {
+ return it.hasNext();
+ }
+
+ @Override
+ public T next() {
+ return f.apply(it.next());
+ }
+
+ @Override
+ public void remove() {
+ it.remove();
+ }
+ };
+ }
+
+ @Override
+ public Iterator iterator() {
+ return iterator;
+ }
+
+ @Override
+ public int size() {
+ return src.size();
+ }
+}
\ No newline at end of file