+ this.client = new Client(new URLConnectionClientHandler(new HttpURLConnectionFactory() {
+ Proxy proxy = null;
+
+ @Override
+ public HttpURLConnection getHttpURLConnection(URL url) throws IOException {
+ try {
+ String proxyIp = System.getenv("JENKINS_PROXY").substring(0,
+ System.getenv("JENKINS_PROXY").lastIndexOf(":"));
+ String proxyPort = System.getenv("JENKINS_PROXY")
+ .substring(System.getenv("JENKINS_PROXY").lastIndexOf(":") + 1);
+ proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyIp, Integer.parseInt(proxyPort)));
+ return (HttpURLConnection) url.openConnection(proxy);
+ } catch (Exception ex) {
+ return (HttpURLConnection) url.openConnection();
+ }
+ }
+ }), clientConfig);