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

    testChannel = new TestPipeChannel();
    PipeChannelInputStream input = new PipeChannelInputStream(testChannel, Duration.ofSeconds(1));
    assertThat(Stopwatch.measure(() -> {
        try {
            input.read();
            fail("Read operation must not complete.");
        } catch (SocketTimeoutException e) {
            // OK
        } catch (IOException e) {
            fail("Read failed.", e);
        }
    }).toMillis()).isCloseTo(1000, Offset.offset(150L));
}