diff --git a/src/main/java/rs/iggy/clients/blocking/tcp/TcpConnectionHandler.java b/src/main/java/rs/iggy/clients/blocking/tcp/TcpConnectionHandler.java index d218248..f40e141 100644 --- a/src/main/java/rs/iggy/clients/blocking/tcp/TcpConnectionHandler.java +++ b/src/main/java/rs/iggy/clients/blocking/tcp/TcpConnectionHandler.java @@ -65,9 +65,11 @@ protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteB if (byteBuf.readableBytes() < RESPONSE_INITIAL_BYTES_LENGTH) { return; } + byteBuf.markReaderIndex(); var status = byteBuf.readUnsignedIntLE(); var responseLength = byteBuf.readUnsignedIntLE(); if (byteBuf.readableBytes() < responseLength) { + byteBuf.resetReaderIndex(); return; } var length = Long.valueOf(responseLength).intValue();