  @Test
  public void testSplitUpWrites() throws IOException {

    PipedInputStream pipedInputStream = new PipedInputStream();
    PipedOutputStream pipedOutputStream = new PipedOutputStream(pipedInputStream);
    PollingInputStream pollingInputStream =
        new PollingInputStream(pipedInputStream, Executors.newCachedThreadPool());
    byte[] expectedBuffer = new byte[64];
    for (int i = 0; i < expectedBuffer.length; i++) {
      expectedBuffer[i] = (byte) i;
    }
    pipedOutputStream.write(expectedBuffer, 0, 16);
    pipedOutputStream.write(expectedBuffer, 16, 16);
    pipedOutputStream.write(expectedBuffer, 32, 16);
    pipedOutputStream.write(expectedBuffer, 48, 16);
    byte[] actualBuffer = new byte[64];
    assertEquals(64, pollingInputStream.read(actualBuffer));
    assertArrayEquals(expectedBuffer, actualBuffer);
  }