Service service = new MockService(name, new InOutService(), inHandler);
ServiceReference reference = new ServiceReferenceImpl(name, new InOutService(), null, null);
Dispatcher dispatch = _provider.createDispatcher(reference);
Exchange exchange = dispatch.createExchange(outHandler, ExchangePattern.IN_OUT);
exchange.consumer(reference, reference.getInterface().getOperation(ServiceInterface.DEFAULT_OPERATION));
exchange.provider(service, service.getInterface().getOperation(ServiceInterface.DEFAULT_OPERATION));
Message message = exchange.createMessage();
exchange.send(message.setContent(REQUEST));
Thread.sleep(400);
Exchange lastExchange = outHandler.getLastExchange();
assertNotNull(lastExchange);
// assertEquals(REQUEST, lastExchange.getMessage().getContent());
Property messageId = message.getContext().getProperty(Exchange.MESSAGE_ID);
assertNotNull("Message id must be available after sending message and receiving response", messageId);
Property relatesTo = lastExchange.getContext().getProperty(Exchange.RELATES_TO);
assertNotNull("Relates to must be specified for outgoing message", relatesTo);
assertEquals("Relates to property should point to in message id", messageId.getValue(), relatesTo.getValue());
}