FluentProducerTemplate with netty-http component. Request method with timeout is not working

80 Views Asked by At

I'm trying to send request to wrong IP and want to catch request time-out exception. Even though I sent request to wrong IP, it is ended normally.

Source is like below.

try {
  FluentProducerTemplate fluentProducerTemplate = exchange.getContext().createFluentProducerTemplate();

  log.debug("START");

// 111.111.111.111:1111 is wrong IP sample
  Message message = fluentProducerTemplate.to("netty-http:http://111.111.111.111:1111/?clientMode=true&connectTimeout=5000").request(Message.class);

  log.debug("DONE");

} catch ( Exception e ) {
  log.debug("FAIL");
}

I think it should be ended with "FAIL", but it's not. Log message "DONE" is printed after 5 seconds from "START". And response message is null.

Is there any way to make exception if connection time-out?

0

There are 0 best solutions below