@Test
public void testGet() throws IOException, InterruptedException, ExecutionException {

    final ResponseEvent event = createResponseEvent();
    // Use mockito when command so that when snmp.send is called it
    // will return event. Use argThat to provide custom matchers.  In the
    // matchers we check that the parameters passed to snmp.send are as
    // expected
    doAnswer(invocation -> {
        ResponseListener callback = (ResponseListener) invocation.getArguments()[3];
        callback.onResponse(event);
        return null;
    }).when(mockSnmp).send(argThat(pdu -> {
        assertEquals("Checking PDU Get type", pdu.getType(), PDU.GET);
        assertEquals("Checking PDU OID value", pdu.getVariableBindings().get(0).getOid().toString(),
                SYS_OID_REQUEST);
        assertEquals("Checking max repititions", pdu.getMaxRepetitions(), MAXREPETITIONS);
        return true;
    }), argThat(target -> {
        assertEquals(target.getSecurityName().toString(), COMMUNITY);
        assertEquals(target.getAddress().toString(), GET_IP_ADDRESS + "/" + SNMP_LISTEN_PORT.toString());
        assertEquals(target.getTimeout(), TIMEOUT);
        assertEquals(target.getRetries(), RETRIES);
        assertEquals(target.getVersion(), SnmpConstants.version2c);
        return true;
    }), any(), (ResponseListener) any());
    String value = "Failed";
    String oid = "bad oid";
    Ipv4Address ip = new Ipv4Address(GET_IP_ADDRESS);
    SnmpGetInputBuilder input = new SnmpGetInputBuilder();
    input.setCommunity(COMMUNITY);
    input.setIpAddress(ip);
    input.setOid(SYS_OID_REQUEST);
    input.setGetType(SnmpGetType.GET);
    Future<RpcResult<SnmpGetOutput>> resultFuture = snmpImpl.snmpGet(input.build());
    RpcResult<SnmpGetOutput> result = resultFuture.get();
    if (result.isSuccessful()) {
        SnmpGetOutput output = result.getResult();
        List<Results> snmpResults = output.getResults();
        if (snmpResults.size() == 1) {
            for (Results r: snmpResults) {
                value = r.getValue();
                oid = r.getOid();
                break;
            }
        }
    }
    assertEquals(value, SYS_OID_RESPONSE);
    assertEquals(oid, SYS_OID_REQUEST);
}