@Test
public void testCopyChunkNotEnoughSpace() {

    byte[] hello = "Hello".getBytes(UTF_8);
    byte[] space = " ".getBytes(UTF_8);
    byte[] world = "World".getBytes(UTF_8);
    int length = hello.length + space.length + world.length;
    ByteAccumulator accumulator = new ByteAccumulator(length - 2); // intentionally too small of a max
    accumulator.copyChunk(hello, 0, hello.length);
    accumulator.copyChunk(space, 0, space.length);
    MessageTooLargeException e = assertThrows(MessageTooLargeException.class, () -> accumulator.copyChunk(world, 0, world.length));
    System.out.println(e.getMessage());
    assertTrue(e.getMessage().contains("too large for configured max"));
}