StopWatch watch = new StopWatch();
try {
template.requestBody("seda:a?timeout=5000", "Hello World");
fail("Should have thrown an exception");
} catch (CamelExecutionException e) {
ExchangeTimedOutException cause = assertIsInstanceOf(ExchangeTimedOutException.class, e.getCause());
assertEquals(2000, cause.getTimeout());
}
long delta = watch.stop();
assertTrue("Should be faster than 4000 millis, was: " + delta, delta < 4000);
}