@Test public void testGetOption() throws Exception { Object expected = new Object(); when(delegate, "getOption", 1).thenReturn(expected); Object actual = sniffySocket.getOption(1); verifyPrivate(delegate).invoke("getOption", 1); verifyNoMoreInteractions(delegate); assertEquals(expected, actual); }
@Override public Object getOption(int optID) throws SocketException { copyToDelegate(); long start = System.currentTimeMillis(); try { return delegate.getOption(optID); } finally { logSocket(System.currentTimeMillis() - start); copyFromDelegate(); } }
SnifferSocketImpl extends SocketImpl implements SniffySocket { @Override public Object getOption(int optID) throws SocketException { copyToDelegate(); long start = System.currentTimeMillis(); try { return delegate.getOption(optID); } finally { logSocket(System.currentTimeMillis() - start); copyFromDelegate(); } } }
SnifferSocketImpl extends SocketImpl implements SniffySocket { @Override public Object getOption(int optID) throws SocketException { copyToDelegate(); long start = System.currentTimeMillis(); try { return delegate.getOption(optID); } finally { logSocket(System.currentTimeMillis() - start); copyFromDelegate(); } } protected  SnifferSocketImpl(SocketImpl delegate); }
SnifferSocketImpl extends SocketImpl implements SniffySocket { @Override public Object getOption(int optID) throws SocketException { copyToDelegate(); long start = System.currentTimeMillis(); try { return delegate.getOption(optID); } 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 Object getOption(int optID) throws SocketException { copyToDelegate(); long start = System.currentTimeMillis(); try { return delegate.getOption(optID); } 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();  }