RmiClient extends AbstractEndpoint implements Producer, ReplyConsumer { public RmiClient() { this(new RmiEndpointConfiguration()); } RmiClient();  RmiClient(RmiEndpointConfiguration endpointConfiguration); @Override RmiEndpointConfiguration getEndpointConfiguration(); @Override void send(final Message message, TestContext context); @Override Message receive(TestContext context); @Override Message receive(String selector, TestContext context); @Override Message receive(TestContext context, long timeout); @Override Message receive(String selector, TestContext context, long timeout); @Override Producer createProducer(); @Override SelectiveConsumer createConsumer(); void setCorrelationManager(CorrelationManager<Message> correlationManager);  }
@Test public void testRmiClient() throws Exception { RmiEndpointConfiguration endpointConfiguration = new RmiEndpointConfiguration(); RmiClient rmiClient = new RmiClient(endpointConfiguration); String binding = "helloService"; final String responseBody = FileCopyUtils.copyToString(new InputStreamReader(new ClassPathResource("service-result.xml", RmiClient.class).getInputStream())); endpointConfiguration.setBinding(binding); Message requestMessage = RmiMessage.invocation("getHelloCount"); endpointConfiguration.setRegistry(registry); reset(registry, remoteInterface); when(registry.lookup(binding)).thenReturn(remoteInterface); when(remoteInterface.getHelloCount()).thenReturn(100); rmiClient.send(requestMessage, context); Message responseMessage = rmiClient.receive(context, endpointConfiguration.getTimeout()); Assert.assertEquals(StringUtils.trimAllWhitespace(responseMessage.getPayload(String.class)), StringUtils.trimAllWhitespace(responseBody)); }