I am invoking external system with rest template and it's working fine in my local without any timeout settings, but on my test server, it's giving me the following error:
I/O error on POST request for "https://externalsystem/url": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
HttpEntity<MultiValueMap<String, String>> request = new
HttpEntity<MultiValueMap<String, String>>(map, headers);
map.add("key", value);
restTemplate.postForEntity(url, request, String.class);