### Question:
StringSockets { @VisibleForTesting static Action1<Socket> socketDisposer() { return socket -> { try { log.info("closing socket " + socket.getInetAddress().getHostAddress() + ":" + socket.getPort()); socket.close(); } catch (IOException e) { log.info("messageOnSocketClose=" + e.getMessage(), e); } }; }  static Observable<String> from(final String host, final int port, long quietTimeoutMs,
            long reconnectDelayMs, Charset charset, Scheduler scheduler); static Observable<String> from(Func0<Socket> socketCreator, long quietTimeoutMs,
            long reconnectDelayMs, Charset charset, Scheduler scheduler); static Builder from(String host); static Observable<String> strings(final String host, final int port, int quietTimeoutMs,
            final Charset charset); static Observable<String> strings(Func0<Socket> socketCreator, final Charset charset); static Observable<String> mergeLinesFrom(Observable<HostPort> hostPorts,
            Scheduler scheduler); static Observable<String> mergeLinesFrom(Observable<HostPort> hostPorts, int maxLineLength); static Observable<String> mergeLinesFrom(Observable<HostPort> hostPorts,
            Scheduler scheduler, int maxLineLength); static Observable<String> mergeLinesFrom(Observable<HostPort> hostPorts); static void main(String[] args);  }### Answer:
@Test public void testSocketDisposerOnException() throws IOException { Socket socket = mock(Socket.class); InetAddress address = mock(InetAddress.class); doReturn(address).when(socket).getInetAddress(); doReturn("ahost").when(address).getHostAddress(); doReturn(1234).when(socket).getPort(); doThrow(new IOException("hi")).when(socket).close(); StringSockets.socketDisposer().call(socket); }