String s = exchange.getIn().getBody(String.class);
if ("Hello NPE".equals(s)) {
throw new NullPointerException();
} else if ("Hello IOE".equals(s)) {
// specialized IOException
throw new ConnectException("Forced for testing - can not connect to remote server");
}
exchange.getOut().setBody("Hello World");
}
}).to("mock:result");
}