@Test public void testGetProxy() { String host = System.getProperty("http.proxyHost"); String port = System.getProperty("http.proxyPort"); RequestConfig g = ConnectionUtil.getProxyConfig(); System.setProperty("http.proxyHost", "proxy"); System.setProperty("http.proxyPort", "80"); g = ConnectionUtil.getProxyConfig(); assertEquals(g.getProxy().toString(), "http: System.setProperty("http.proxyPort", ""); g = ConnectionUtil.getProxyConfig(); assertEquals(g, null); if (host != null) System.setProperty("http.proxyHost", host); if (port != null) System.setProperty("http.proxyPort", port); }
public static RequestConfig getProxyConfig() { RequestConfig config = null; final String phost = System.getProperty("http.proxyHost", null); final String pport = System.getProperty("http.proxyPort", "-1"); int pport_int = -1; try { pport_int = Integer.parseInt(pport); } catch (NumberFormatException e) { log.warn( "The value '" + pport + "' is not a valid proxy port, the request will be executed without proxy"); } if (phost != null && pport_int != -1) { final HttpHost http_proxy = new HttpHost(phost, pport_int, "http"); config = RequestConfig.custom().setProxy(http_proxy).build(); } return config; }
ConnectionUtil { public static RequestConfig getProxyConfig() { RequestConfig config = null; final String phost = System.getProperty("http.proxyHost", null); final String pport = System.getProperty("http.proxyPort", "-1"); int pport_int = -1; try { pport_int = Integer.parseInt(pport); } catch (NumberFormatException e) { log.warn( "The value '" + pport + "' is not a valid proxy port, the request will be executed without proxy"); } if (phost != null && pport_int != -1) { final HttpHost http_proxy = new HttpHost(phost, pport_int, "http"); config = RequestConfig.custom().setProxy(http_proxy).build(); } return config; } }
ConnectionUtil { public static RequestConfig getProxyConfig() { RequestConfig config = null; final String phost = System.getProperty("http.proxyHost", null); final String pport = System.getProperty("http.proxyPort", "-1"); int pport_int = -1; try { pport_int = Integer.parseInt(pport); } catch (NumberFormatException e) { log.warn( "The value '" + pport + "' is not a valid proxy port, the request will be executed without proxy"); } if (phost != null && pport_int != -1) { final HttpHost http_proxy = new HttpHost(phost, pport_int, "http"); config = RequestConfig.custom().setProxy(http_proxy).build(); } return config; }  }
ConnectionUtil { public static RequestConfig getProxyConfig() { RequestConfig config = null; final String phost = System.getProperty("http.proxyHost", null); final String pport = System.getProperty("http.proxyPort", "-1"); int pport_int = -1; try { pport_int = Integer.parseInt(pport); } catch (NumberFormatException e) { log.warn( "The value '" + pport + "' is not a valid proxy port, the request will be executed without proxy"); } if (phost != null && pport_int != -1) { final HttpHost http_proxy = new HttpHost(phost, pport_int, "http"); config = RequestConfig.custom().setProxy(http_proxy).build(); } return config; }  static RequestConfig getProxyConfig(); static String readInputStream(@NotNull InputStream _is); }
ConnectionUtil { public static RequestConfig getProxyConfig() { RequestConfig config = null; final String phost = System.getProperty("http.proxyHost", null); final String pport = System.getProperty("http.proxyPort", "-1"); int pport_int = -1; try { pport_int = Integer.parseInt(pport); } catch (NumberFormatException e) { log.warn( "The value '" + pport + "' is not a valid proxy port, the request will be executed without proxy"); } if (phost != null && pport_int != -1) { final HttpHost http_proxy = new HttpHost(phost, pport_int, "http"); config = RequestConfig.custom().setProxy(http_proxy).build(); } return config; }  static RequestConfig getProxyConfig(); static String readInputStream(@NotNull InputStream _is);  }