NPipeSocket extends Socket { @Override public void bind(SocketAddress bindpoint) throws IOException { throw new UnsupportedSocketOperationException("This type of Socket cannot be bound."); } NPipeSocket(); private  NPipeSocket(NPipeSocketImpl impl); @Override void bind(SocketAddress bindpoint); @Override boolean isConnected(); @Override boolean isBound(); @Override SocketAddress getLocalSocketAddress(); @Override void connect(SocketAddress endpoint, int timeout); @Override synchronized void close(); @Override boolean isClosed();  }
@Test public void bind() throws IOException { NPipeSocket socket = new NPipeSocket(); assertThat(socket.isBound()).isFalse(); assertThatExceptionOfType(UnsupportedSocketOperationException.class) .isThrownBy(() -> socket.bind(null)); assertThat(socket.isBound()).isFalse(); }