@Override
    public void decode(final ChannelHandlerContext context, final ByteBuf in, final List<Object> out) {
        int payloadLength = in.markReaderIndex().readUnsignedMediumLE();
        int remainPayloadLength = SEQUENCE_LENGTH + payloadLength;
        if (in.readableBytes() < remainPayloadLength) {
            in.resetReaderIndex();
            return;
        }
        ByteBuf message = in.readRetainedSlice(remainPayloadLength);
        if (MAX_PACKET_LENGTH == payloadLength) {
            pendingMessages.add(message.skipBytes(SEQUENCE_LENGTH));
        } else if (pendingMessages.isEmpty()) {
            out.add(message);
        } else {
            aggregateMessages(context, message, out);
        }
    }
@Test
    void assertDecodeWithStickyPacket() {
        when(byteBuf.markReaderIndex()).thenReturn(byteBuf);
        when(byteBuf.readUnsignedMediumLE()).thenReturn(50);
        List<Object> out = new LinkedList<>();
        new MySQLPacketCodecEngine().decode(context, byteBuf, out);
        assertTrue(out.isEmpty());
    }