}
public void testInOptOutWithRepAndConsumerFault() throws Exception {
// Send message exchange
MessageExchangeFactory mef = consumer.getChannel().createExchangeFactory(endpoint);
InOptionalOut mec = mef.createInOptionalOutExchange();
NormalizedMessage m = mec.createMessage();
m.setContent(new StreamSource(new ByteArrayInputStream(PAYLOAD.getBytes())));
mec.setInMessage(m);
consumer.getChannel().send(mec);
// Provider side
InOptionalOut mep = (InOptionalOut) provider.getChannel().accept(10L);
assertNotNull(mep);
assertEquals(ExchangeStatus.ACTIVE, mep.getStatus());
m = mep.createMessage();
m.setContent(new StreamSource(new ByteArrayInputStream(RESPONSE.getBytes())));
mep.setOutMessage(m);
provider.getChannel().send(mep);
// Consumer side
assertSame(mec, consumer.getChannel().accept(10L));
assertEquals(ExchangeStatus.ACTIVE, mec.getStatus());
mec.setStatus(ExchangeStatus.ERROR);
consumer.getChannel().send(mec);
// Provider site
assertSame(mep, provider.getChannel().accept(10L));
assertEquals(ExchangeStatus.ERROR, mep.getStatus());
mep.setStatus(ExchangeStatus.DONE);
provider.getChannel().send(mep);
// Consumer side
assertSame(mec, consumer.getChannel().accept(10L));
assertEquals(ExchangeStatus.DONE, mec.getStatus());
// Nothing left