@Test public void testToString() throws Exception { String expected = "expected"; when(delegate, "toString").thenReturn(expected); String actual = sniffySocket.toString(); verifyNoMoreInteractions(delegate); assertEquals(expected, actual); }
@Override public String toString() { copyToDelegate(); long start = System.currentTimeMillis(); try { return delegate.toString(); } finally { logSocket(System.currentTimeMillis() - start); copyFromDelegate(); } }
SnifferSocketImpl extends SocketImpl implements SniffySocket { @Override public String toString() { copyToDelegate(); long start = System.currentTimeMillis(); try { return delegate.toString(); } finally { logSocket(System.currentTimeMillis() - start); copyFromDelegate(); } } }
SnifferSocketImpl extends SocketImpl implements SniffySocket { @Override public String toString() { copyToDelegate(); long start = System.currentTimeMillis(); try { return delegate.toString(); } finally { logSocket(System.currentTimeMillis() - start); copyFromDelegate(); } } protected  SnifferSocketImpl(SocketImpl delegate); }
SnifferSocketImpl extends SocketImpl implements SniffySocket { @Override public String toString() { copyToDelegate(); long start = System.currentTimeMillis(); try { return delegate.toString(); } finally { logSocket(System.currentTimeMillis() - start); copyFromDelegate(); } } protected  SnifferSocketImpl(SocketImpl delegate); @Override void setConnectionStatus(Integer connectionStatus); @Override String toString(); @Override void setOption(int optID, Object value); @Override Object getOption(int optID); @Override InetSocketAddress getInetSocketAddress(); }
SnifferSocketImpl extends SocketImpl implements SniffySocket { @Override public String toString() { copyToDelegate(); long start = System.currentTimeMillis(); try { return delegate.toString(); } finally { logSocket(System.currentTimeMillis() - start); copyFromDelegate(); } } protected  SnifferSocketImpl(SocketImpl delegate); @Override void setConnectionStatus(Integer connectionStatus); @Override String toString(); @Override void setOption(int optID, Object value); @Override Object getOption(int optID); @Override InetSocketAddress getInetSocketAddress();  }