try
{
String initialSuffix = ".ftpmsg";
// Send a Message that will be picked up by a listener, and specify replyTo
FTPEpr toEpr = new FTPEpr(ftpUrl);
toEpr.setInputSuffix(initialSuffix);
toEpr.setPostDelete(true);
FTPEpr replyToEpr = (FTPEpr)DefaultReplyTo.getReplyTo(toEpr);
String text_1 = "Outgoing";
Message outgoingMsg = MessageFactory.getInstance().getMessage();
outgoingMsg.getHeader().getCall().setTo(toEpr);
outgoingMsg.getHeader().getCall().setReplyTo(replyToEpr);
outgoingMsg.getBody().add(text_1.getBytes());
CourierUtil.deliverMessage(outgoingMsg);
// Mock a service that picks up the original message and replies
FTPEpr serviceEpr = new FTPEpr(toEpr.getURI());
serviceEpr.setInputSuffix(initialSuffix);
serviceEpr.setPostDelete(true);
PickUpOnlyCourier listener = CourierFactory.getPickupCourier(serviceEpr);
Message received = listener.pickup(100);
String text_2 = new String((byte[]) received.getBody().get());
assertTrue(text_1.equals(text_2));
assertTrue(replyToEpr.equals(received.getHeader().getCall().getReplyTo()));