@Test
public void testDecodeNotCompleteMessage() throws Exception {

    byte[] inputByte = IPFIXUtilTestHelper.collectMessage("ONT1", "$6$SW2yXjnVMkUwIUeQ$c.JydO461NKo/VTgTYbvtEyVnKQhUr4NRFaFQD3YI5UfC28WTSewVAaR6UjloBFa.N4lVYrr1at25omRhbPOI.", "admin");
    byte[] inputByteFirstHalf = IpfixUtilities.copyByteArray(inputByte, 0, 300);
    byte[] inputByteSecondHalf = IpfixUtilities.copyByteArray(inputByte, 300, inputByte.length - 300);
    byte[] testByte = ArrayUtils.addAll(inputByte, inputByteFirstHalf);
    ByteBuf byteBuf = Unpooled.buffer(testByte.length + inputByteSecondHalf.length);
    byteBuf.writeBytes(testByte);
    IpfixMessageDecoder IpfixMessageDecoder = new IpfixMessageDecoder();
    ChannelHandlerContext ctx = mock(ChannelHandlerContext.class);
    List<Object> checkedList = new ArrayList<>();
    IpfixMessageDecoder.decode(ctx, byteBuf, checkedList);
    assertEquals(1, checkedList.size());
    IpfixMessagesWrapper ipfixMessagesWrapper = (IpfixMessagesWrapper) checkedList.get(0);
    assertArrayEquals(inputByte, ipfixMessagesWrapper.getData());
    // Send remaining data
    byteBuf.writeBytes(inputByteSecondHalf);
    IpfixMessageDecoder.decode(ctx, byteBuf, checkedList);
    assertEquals(2, checkedList.size());
    Object checkedOutput2 = checkedList.get(1);
    IpfixMessagesWrapper ipfixMessagesWrapper2 = (IpfixMessagesWrapper) checkedOutput2;
    assertArrayEquals(inputByte, ipfixMessagesWrapper2.getData());
}