@Test public void testSendUrgentDataThrowsRuntimeException() throws Exception { RuntimeException expected = new RuntimeException(); when(delegate, "sendUrgentData", anyInt()).thenThrow(expected); try { sniffySocket.sendUrgentData(1); fail(); } catch (Exception actual) { assertEquals(expected, actual); } verifyPrivate(delegate).invoke("sendUrgentData", 1); verifyNoMoreInteractions(delegate); }
@Override protected void sendUrgentData(int data) throws IOException { copyToDelegate(); long start = System.currentTimeMillis(); try { checkConnectionAllowed(1); method("sendUrgentData", int.class).invoke(delegate, data); } catch (Exception e) { ExceptionUtil.processException(e); } finally { logSocket(System.currentTimeMillis() - start); copyFromDelegate(); } }
SnifferSocketImpl extends SocketImpl implements SniffySocket { @Override protected void sendUrgentData(int data) throws IOException { copyToDelegate(); long start = System.currentTimeMillis(); try { checkConnectionAllowed(1); method("sendUrgentData", int.class).invoke(delegate, data); } catch (Exception e) { ExceptionUtil.processException(e); } finally { logSocket(System.currentTimeMillis() - start); copyFromDelegate(); } } }
SnifferSocketImpl extends SocketImpl implements SniffySocket { @Override protected void sendUrgentData(int data) throws IOException { copyToDelegate(); long start = System.currentTimeMillis(); try { checkConnectionAllowed(1); method("sendUrgentData", int.class).invoke(delegate, data); } catch (Exception e) { ExceptionUtil.processException(e); } finally { logSocket(System.currentTimeMillis() - start); copyFromDelegate(); } } protected  SnifferSocketImpl(SocketImpl delegate); }
SnifferSocketImpl extends SocketImpl implements SniffySocket { @Override protected void sendUrgentData(int data) throws IOException { copyToDelegate(); long start = System.currentTimeMillis(); try { checkConnectionAllowed(1); method("sendUrgentData", int.class).invoke(delegate, data); } catch (Exception e) { 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 void sendUrgentData(int data) throws IOException { copyToDelegate(); long start = System.currentTimeMillis(); try { checkConnectionAllowed(1); method("sendUrgentData", int.class).invoke(delegate, data); } catch (Exception e) { 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();  }