PostgreSQLPacketCodecEngine implements DatabasePacketCodecEngine<PostgreSQLPacket> { @Override public boolean isValidHeader(final int readableBytes) { return readableBytes >= PostgreSQLPacket.MESSAGE_TYPE_LENGTH + PostgreSQLPacket.PAYLOAD_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 PostgreSQLPacket message, final ByteBuf out); @Override PostgreSQLPacketPayload createPacketPayload(final ByteBuf message);  }
@Test public void assertIsValidHeader() { assertTrue(new PostgreSQLPacketCodecEngine().isValidHeader(50)); }
@Test public void assertIsInvalidHeader() { assertFalse(new PostgreSQLPacketCodecEngine().isValidHeader(PostgreSQLPacket.PAYLOAD_LENGTH)); }