JgroupsMessageReceiver extends ReceiverAdapter implements RequestHandler { public Responder addResponder(Class clazz, Responder responder) { return this.responders.put(clazz, responder); } JgroupsMessageReceiver(Map<Class, Responder> responders, RemoteServiceHandlesStore store); void setMyAddress(Address myAddress); Responder addResponder(Class clazz, Responder responder); @Override void receive(final Message msg); @Override void viewAccepted(final View view); @Override Object handle(Message msg);  }
@Test public void testAddResponder() throws Exception { JgroupsMessageReceiver jgroupsMessageReceiver = new JgroupsMessageReceiver(generateRespondersMap(), new RemoteServiceHandlesStore()); jgroupsMessageReceiver.addResponder(String.class, responder2); jgroupsMessageReceiver.receive(STRING_MSG); new Verifications() {{ responder2.processMessage(STRING_MSG); times = 1; responder1.processMessage((Message) any); times = 0; }}; }