@Test
public void close() throws IOException {

    PipeChannel channel = DefaultPipeChannel.open(tempFile());
    channel.close();
    assertThatExceptionOfType(ExecutionException.class)
            .isThrownBy(() -> channel.write(ByteBuffer.allocate(1)).get())
            .withCauseInstanceOf(ClosedChannelException.class);
    assertThatExceptionOfType(ExecutionException.class)
            .isThrownBy(() -> channel.read(ByteBuffer.allocate(1)).get())
            .withCauseInstanceOf(ClosedChannelException.class);
    channel.close(); // Idempotent.
}