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

    int writeBufferSize = 4;
    byte[] msgBytes = "Hello world!".getBytes(StandardCharsets.UTF_8);
    assertThat(msgBytes.length).isGreaterThan(writeBufferSize);
    testChannel = new TestPipeChannel(writeBufferSize);
    PipeChannelOutputStream output = new PipeChannelOutputStream(testChannel, Duration.ofSeconds(0));
    Future<Void> future = runAsync(() -> {
        try {
            output.write(msgBytes);
            fail("Write operation must not complete.");
        } catch (SocketTimeoutException e) {
            fail("Unexpected timeout.", e);
        } catch (IOException e) {
            fail("Read failed.", e);
        }
    });
    try {
        future.get(2, TimeUnit.SECONDS);
    } catch (InterruptedException | ExecutionException e) {
        fail("Unexpected failure.", e);
    } catch (TimeoutException e) {
        // OK
    }
}