@Test public void shouldSendMockSetCall() { SnmpSession testSession = null; try { testSession = new SnmpSession(testProps); } catch (IOException e) { fail("Unexpected exception: " + e); } PDU mockPDU = Mockito.mock(PDU.class); Snmp mockSnmp = Mockito.mock(Snmp.class); UserTarget mockTarget = Mockito.mock(UserTarget.class); try { testSession.set(mockPDU, mockSnmp, mockTarget, false); } catch (IOException e) { fail("Unexpected error: " + e); } }
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);  }