public class RedeliveryErrorHandlerAsyncDelayedTwoCamelContextIssueTest {
@Test
public void shouldNotBreakRedeliveriesOfSecondContextAfterFirstBeingStopped() throws Exception {
DefaultCamelContext context1 = createContext();
ProducerTemplate producer1 = context1.createProducerTemplate();
ConsumerTemplate consumer1 = context1.createConsumerTemplate();
context1.start();
producer1.sendBody("seda://input", "Hey1");
Exchange ex1 = consumer1.receive("seda://output", 5000);
DefaultCamelContext context2 = createContext();
ProducerTemplate producer2 = context2.createProducerTemplate();
ConsumerTemplate consumer2 = context2.createConsumerTemplate();
context2.start();
// now stop 1, and see that 2 is still working
consumer1.stop();
producer1.stop();
context1.stop();
producer2.sendBody("seda://input", "Hey2");
Exchange ex2 = consumer2.receive("seda://output", 5000);
Assert.assertNotNull(ex1);
Assert.assertEquals("Hey1", ex1.getIn().getBody());
Assert.assertNotNull(ex2);
Assert.assertEquals("Hey2", ex2.getIn().getBody());
consumer2.stop();
producer2.stop();
context2.stop();
}