NPipeSocketImpl extends SocketImpl { @Override protected void close() throws IOException { lock.runChecked(() -> { if (pipeChannel != null) { pipeChannel.close(); closed = true; } }); }  @Override void setOption(int optID, Object value); @Override Object getOption(int optID); boolean isClosed();  }
@Test public void close() throws IOException { NPipeSocketImpl impl = new NPipeSocketImpl(); connect(impl); PipeChannelInputStream inputStream = (PipeChannelInputStream) impl.getInputStream(); PipeChannelOutputStream outputStream = (PipeChannelOutputStream) impl.getOutputStream(); assertThat(inputStream.isOpen()).isTrue(); assertThat(outputStream.isOpen()).isTrue(); impl.close(); assertThat(inputStream.isOpen()).isFalse(); assertThat(outputStream.isOpen()).isFalse(); impl.close(); }