@Test(timeout = 10000)
public void targetChannelClosed() throws Exception {

    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(1));
    CompletableFuture<Void> futur = runAsync(() -> {
        try {
            output.write(msgBytes);
        } catch (IOException e) {
            // OK
        }
    });
    testChannel.shutdownOutputStreams();
    futur.get(500, TimeUnit.MILLISECONDS);
}