@Test(timeout = 10000)
public void readWithOffsetUndLength() throws IOException {

    testChannel = new TestPipeChannel();
    PipeChannelInputStream input = new PipeChannelInputStream(testChannel, Duration.ofSeconds(2));
    byte[] msgBytes = new byte[]{1, 2, 3};
    byte[] buffer = new byte[msgBytes.length + 4];
    testChannel.putInReadBuffer(msgBytes);
    int n = input.read(buffer, 2, buffer.length - 2);
    assertThat(n).isEqualTo(msgBytes.length);
    assertThat(buffer).containsExactly((byte) 0, (byte) 0, (byte) 1, (byte) 2, (byte) 3, (byte) 0, (byte) 0);
    Arrays.fill(buffer, (byte) 0);
    testChannel.exhaustReadBuffer();
    testChannel.putInReadBuffer(msgBytes);
    n = input.read(buffer, 0, 2);
    assertThat(n).isEqualTo(2);
    assertThat(buffer).containsExactly((byte) 1, (byte) 2, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0);
    Arrays.fill(buffer, (byte) 0);
    testChannel.exhaustReadBuffer();
    testChannel.putInReadBuffer(msgBytes);
    n = input.read(buffer, 2, 2);
    assertThat(n).isEqualTo(2);
    assertThat(buffer).containsExactly((byte) 0, (byte) 0, (byte) 1, (byte) 2, (byte) 0, (byte) 0, (byte) 0);
}