@Test
public void connect() throws IOException {

    NPipeSocket socket = new NPipeSocket();
    NPipeSocketImpl impl = socket.getImpl();
    assertThat(socket.isConnected()).isFalse();
    assertThat(impl.isConnected()).isFalse();
    socket.connect(createTestSocket());
    assertThat(socket.isConnected()).isTrue();
    assertThat(impl.isConnected()).isTrue();
    assertThatExceptionOfType(IOException.class)
            .isThrownBy(() -> socket.connect(new InetSocketAddress(InetAddress.getLocalHost(), 80)));
    assertThatExceptionOfType(NullPointerException.class)
            .isThrownBy(() -> socket.connect(null));
}