I have written a code to access Google API. The URL when hit from a browser gives immediate response but when hitting the same URl from Eclipse using a OkHttpClient leads to a connection time out. Have tried using various methods to hit the URL still its a connection time out every time. I even tried using HTTP instead of HTTPS but still no luck. I have no much knowledge in networking but it seems issue is due to office network since code works fine with my home network. Also I have tries setting a higher timeout value still it never connects. So please let me know what might be the probable reason and how to overcome the office proxy or whatever is creating the issue. Below is the code which I am using currently
public static String getAPIData(String finalURL) throws Exception {
// TODO Auto-generated method stub
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(finalURL).build();
Response response = client.newCall(request).execute();
return response.body().string();
}