Connection through HttpConfigurable failed

I'm using HttpConfigurable class to obtain a HttpURLConnection in-order to get a connection which respects IDEA's proxy settings. But at the moment, what I get is a connect timeout when I call con.connect(). This only happens for remote connections and works fine for local connections. Is there any other configuration I am missing here?

 HttpURLConnection con = HttpConfigurable.getInstance().openHttpConnection(url);
con.setRequestMethod(HttpMethod.GET);
con.setRequestProperty(HttpHeaders.ACCEPT_ENCODING, MediaType.APPLICATION_JSON);
con.connect();

Please sign in to leave a comment.