final String inMsgContent = "in message";
final String outMsgContent = "out message";
// create a handler to test that the in and out content match
// expected result from getMessage()
ExchangeHandler provider = new BaseHandler() {
public void handleMessage(Exchange exchange) {
Assert.assertEquals(
exchange.getMessage().getContent(),
inMsgContent);
Message outMsg = exchange.createMessage();
outMsg.setContent(outMsgContent);
try {
exchange.send(outMsg);
}
catch (Exception ex) {
Assert.fail(ex.toString());
}
}
};
ExchangeHandler consumer = new BaseHandler() {
public void handleMessage(Exchange exchange) {
Assert.assertEquals(
exchange.getMessage().getContent(),
outMsgContent);
}