@Test
 public void shouldNotAccumulateInCompleteFrameSize() {
   ClientMessage accumulator = ClientMessage.create();
   final byte[] array = new byte[] {1, 2, 3};
   final ByteBuffer inBuffer = ByteBuffer.wrap(array);
   assertFalse(accumulator.readFrom(inBuffer));
   assertFalse(accumulator.isComplete());
 }
  @Test
  public void shouldAccumulateClientMessageCorrectly() {
    ClientMessage accumulator = ClientMessage.create();
    final ByteBuffer inBuffer = ByteBuffer.wrap(BYTE_DATA);
    accumulator.readFrom(inBuffer);

    final ByteBuffer byteBuffer = accumulatedByteBuffer(accumulator.buffer(), accumulator.index());
    assertEquals(0, byteBuffer.position());
    assertEquals(accumulator.getFrameLength(), byteBuffer.limit());

    for (int i = 0; i < byteBuffer.limit(); i++) {
      assertEquals(BYTE_DATA[i], byteBuffer.get());
    }
    assertTrue(accumulator.isComplete());
  }