Connection timed out only for wikmedia api on server but works on local <p>Following piece of code was working for the last three years, but all of a sudden it throws connection timed out only in server, but works as intended in localhost. Any comments ?</p> <pre><code> public String getWikiContent(String query) { StringBuilder builder = new StringBuilder(); String path = "https://en.wikipedia.org/w/api.php?action=query&amp;prop=extracts&amp;exintro=1&amp;explaintext=1&amp;titles=" + query + "&amp;format=json&amp;redirects"; try { URL url = new URL(path); HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); urlConn.setRequestProperty("Content-Type", "application/json"); if (urlConn.getResponseCode() != 200) { throw new IOException(urlConn.getResponseMessage()); } InputStream is = urlConn.getInputStream(); BufferedReader buff = new BufferedReader(new InputStreamReader(is)); String line; while ((line = buff.readLine()) != null) { builder.append(line); } }catch (IOException e){ e.printStackTrace(); } return builder.toString(); } </code></pre>