TrapListener extends Thread implements CommandResponder, RegisterTrapCallback { @Override public void registerCallBackForTrapUpdates(ProcessTrapCallBack trapCallBack, String ipAddr, String port) { LOGGER.info("Trap callback registered for IP " + ipAddr + " port " + port); m_callbacks.put(ipAddr, trapCallBack); }  @Override void registerCallBackForTrapUpdates(ProcessTrapCallBack trapCallBack, String ipAddr, String port); @Override void unRegisterCallBackForTrapUpdates(ProcessTrapCallBack trapCallBack, String ipAddr, String port); void startup(); void run(); void shutdown(); @Override void processPdu(CommandResponderEvent event);  }
@Test public void testRegisterCallBackForTrapUpdates() throws Exception { m_trapListener.registerCallBackForTrapUpdates(m_trapCallback, "0.0.0.0", "162"); assertEquals(1, m_trapListener.getNoOfCallbacks()); m_trapListener.registerCallBackForTrapUpdates(m_trapCallback, "127.0.0.1", "222"); assertEquals(2, m_trapListener.getNoOfCallbacks()); m_trapListener.unRegisterCallBackForTrapUpdates(m_trapCallback, "0.0.0.0", "162"); assertEquals(1, m_trapListener.getNoOfCallbacks()); m_trapListener.unRegisterCallBackForTrapUpdates(m_trapCallback, "127.0.0.1", "222"); assertEquals(0, m_trapListener.getNoOfCallbacks()); }