MessageChannel requestChannel = (MessageChannel) applicationContext.getBean("channelD");
DirectChannel responseChannel = (DirectChannel) applicationContext.getBean("channelC");
Map<String, Object> headers = new HashMap<String, Object>();
headers.put(MessageHeaders.REPLY_CHANNEL, responseChannel);
GenericMessage<String> message = new GenericMessage<String>(MESSAGE_BODY, headers);
responseChannel.subscribe(new MessageHandler() {
public void handleMessage(Message<?> message) {
String result = (String) message.getPayload();
assertEquals("Get the wrong result", MESSAGE_BODY + " is processed", result);
}
});