@Test(expected = IOException.class) public void testResponseEventSNMPException(@Mocked Snmp mockSnmp, @Mocked UserTarget mockUserTarget, @Mocked PDU mockPDU) throws IOException { new Expectations() { { mockSnmp.set(mockPDU, mockUserTarget); result = new IOException(); } }; snmpSession.set(mockPDU, mockSnmp, mockUserTarget, false); }
public ResponseEvent set(PDU pdu, Snmp snmpob, UserTarget targetob, Boolean keepOpen) throws IOException { if (!ready) { throw new IOException("Tried to send PDU before SNMP sending service is ready."); } if (!listening) { startListen(); } ResponseEvent responseEvent = null; try { responseEvent = snmpob.set(pdu, targetob); if (!keepOpen) { snmpob.close(); } } catch (IOException e) { throw new IOException("Failed to send SNMP request: " + e); } return responseEvent; }
SnmpSession { public ResponseEvent set(PDU pdu, Snmp snmpob, UserTarget targetob, Boolean keepOpen) throws IOException { if (!ready) { throw new IOException("Tried to send PDU before SNMP sending service is ready."); } if (!listening) { startListen(); } ResponseEvent responseEvent = null; try { responseEvent = snmpob.set(pdu, targetob); if (!keepOpen) { snmpob.close(); } } catch (IOException e) { throw new IOException("Failed to send SNMP request: " + e); } return responseEvent; } }
SnmpSession { public ResponseEvent set(PDU pdu, Snmp snmpob, UserTarget targetob, Boolean keepOpen) throws IOException { if (!ready) { throw new IOException("Tried to send PDU before SNMP sending service is ready."); } if (!listening) { startListen(); } ResponseEvent responseEvent = null; try { responseEvent = snmpob.set(pdu, targetob); if (!keepOpen) { snmpob.close(); } } catch (IOException e) { throw new IOException("Failed to send SNMP request: " + e); } return responseEvent; } SnmpSession(RSU rsu); }
SnmpSession { public ResponseEvent set(PDU pdu, Snmp snmpob, UserTarget targetob, Boolean keepOpen) throws IOException { if (!ready) { throw new IOException("Tried to send PDU before SNMP sending service is ready."); } if (!listening) { startListen(); } ResponseEvent responseEvent = null; try { responseEvent = snmpob.set(pdu, targetob); if (!keepOpen) { snmpob.close(); } } catch (IOException e) { throw new IOException("Failed to send SNMP request: " + e); } return responseEvent; } SnmpSession(RSU rsu); ResponseEvent set(PDU pdu, Snmp snmpob, UserTarget targetob, Boolean keepOpen); ResponseEvent get(PDU pdu, Snmp snmpob, UserTarget targetob, Boolean keepOpen); void startListen(); static ResponseEvent createAndSend(SNMP snmp, RSU rsu, String payload, RequestVerb requestVerb); Snmp getSnmp(); void setSnmp(Snmp snmp); TransportMapping getTransport(); void setTransport(TransportMapping transport); UserTarget getTarget(); void setTarget(UserTarget target); void endSession(); static ScopedPDU createPDU(SNMP snmp, String payload, int index, RequestVerb verb); static VariableBinding getPEncodedVariableBinding(String oid, String val); }
SnmpSession { public ResponseEvent set(PDU pdu, Snmp snmpob, UserTarget targetob, Boolean keepOpen) throws IOException { if (!ready) { throw new IOException("Tried to send PDU before SNMP sending service is ready."); } if (!listening) { startListen(); } ResponseEvent responseEvent = null; try { responseEvent = snmpob.set(pdu, targetob); if (!keepOpen) { snmpob.close(); } } catch (IOException e) { throw new IOException("Failed to send SNMP request: " + e); } return responseEvent; } SnmpSession(RSU rsu); ResponseEvent set(PDU pdu, Snmp snmpob, UserTarget targetob, Boolean keepOpen); ResponseEvent get(PDU pdu, Snmp snmpob, UserTarget targetob, Boolean keepOpen); void startListen(); static ResponseEvent createAndSend(SNMP snmp, RSU rsu, String payload, RequestVerb requestVerb); Snmp getSnmp(); void setSnmp(Snmp snmp); TransportMapping getTransport(); void setTransport(TransportMapping transport); UserTarget getTarget(); void setTarget(UserTarget target); void endSession(); static ScopedPDU createPDU(SNMP snmp, String payload, int index, RequestVerb verb); static VariableBinding getPEncodedVariableBinding(String oid, String val);  }