@Test public void testGetPort() throws Exception { int expected = 1; when(delegate, "getPort").thenReturn(expected); int actual = sniffySocket.getPort(); verifyPrivate(delegate).invoke("getPort"); verifyNoMoreInteractions(delegate); assertEquals(expected, actual); }
@Override protected int getPort() { copyToDelegate(); long start = System.currentTimeMillis(); try { return (Integer) method("getPort").invoke(delegate); } catch (Exception e) { throw ExceptionUtil.processException(e); } finally { logSocket(System.currentTimeMillis() - start); copyFromDelegate(); } }
SnifferSocketImpl extends SocketImpl implements SniffySocket { @Override protected int getPort() { copyToDelegate(); long start = System.currentTimeMillis(); try { return (Integer) method("getPort").invoke(delegate); } catch (Exception e) { throw ExceptionUtil.processException(e); } finally { logSocket(System.currentTimeMillis() - start); copyFromDelegate(); } } }
SnifferSocketImpl extends SocketImpl implements SniffySocket { @Override protected int getPort() { copyToDelegate(); long start = System.currentTimeMillis(); try { return (Integer) method("getPort").invoke(delegate); } catch (Exception e) { throw ExceptionUtil.processException(e); } finally { logSocket(System.currentTimeMillis() - start); copyFromDelegate(); } } protected  SnifferSocketImpl(SocketImpl delegate); }
SnifferSocketImpl extends SocketImpl implements SniffySocket { @Override protected int getPort() { copyToDelegate(); long start = System.currentTimeMillis(); try { return (Integer) method("getPort").invoke(delegate); } catch (Exception e) { throw ExceptionUtil.processException(e); } 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 protected int getPort() { copyToDelegate(); long start = System.currentTimeMillis(); try { return (Integer) method("getPort").invoke(delegate); } catch (Exception e) { throw ExceptionUtil.processException(e); } 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();  }