MySQLPacketCodecEngine implements DatabasePacketCodecEngine<MySQLPacket> { @Override public boolean isValidHeader(final int readableBytes) { return readableBytes >= MySQLPacket.PAYLOAD_LENGTH + MySQLPacket.SEQUENCE_LENGTH; }  @Override boolean isValidHeader(final int readableBytes); @Override void decode(final ChannelHandlerContext context, final ByteBuf in, final List<Object> out, final int readableBytes); @Override void encode(final ChannelHandlerContext context, final MySQLPacket message, final ByteBuf out); @Override MySQLPacketPayload createPacketPayload(final ByteBuf message);  }
@Test public void assertIsValidHeader() { assertTrue(new MySQLPacketCodecEngine().isValidHeader(50)); }
@Test public void assertIsInvalidHeader() { assertFalse(new MySQLPacketCodecEngine().isValidHeader(3)); }