NPipeSocketClientConnectionOperator implements HttpClientConnectionOperator { @Override public void connect(ManagedHttpClientConnection conn, HttpHost host, InetSocketAddress localAddress, int connectTimeout, SocketConfig socketConfig, HttpContext context) throws IOException { NPipeSocket socket = new NPipeSocket(); conn.bind(socket); socket.connect(pipeAddress); socket.setSoTimeout(socketConfig.getSoTimeout()); } NPipeSocketClientConnectionOperator(NPipeSocketAddress pipeAddress); @Override void connect(ManagedHttpClientConnection conn, HttpHost host, InetSocketAddress localAddress, int connectTimeout, SocketConfig socketConfig, HttpContext context); @Override void upgrade(ManagedHttpClientConnection conn, HttpHost host, HttpContext context);  }
@Test public void connect() throws IOException { NPipeSocketAddress address = new NPipeSocketAddress(tempFile()); NPipeSocketClientConnectionOperator clientConnectionOperator = new NPipeSocketClientConnectionOperator(new NPipeSocketAddress(tempFile())); SocketConfig socketConfig = SocketConfig.custom().setSoTimeout(42).build(); TestManagedHttpClientConnection conn = new TestManagedHttpClientConnection(); clientConnectionOperator.connect(conn, null, null, -1, socketConfig, null); NPipeSocket socket = (NPipeSocket) conn.getSocket(); assertThat(socket.getRemoteSocketAddress().equals(address)); assertThat(socket.getSoTimeout()).isEqualTo(42); }