0

Situation is like below.

I'm trying to send request to wrong IP and wanna catch request time-out exception.

Eventhough I sent request to wrong IP, but 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?

007
  • 61
  • 4

0 Answers0