protected HttpURLConnection connect(String url) throws Exception { HttpMessageContext context = HttpMessageContext.getInstance(); context.Debug("GNHttpConnection [connect] connect"); URLConnection uc = null; /* synchronized(context) { Properties prop = System.getProperties();*/ /*NSL20070112 if(isUsingProxy()) { prop.setProperty("proxySet", "true" ); prop.setProperty("proxyHost", getConfig_http_proxy_url()); prop.setProperty("proxyPort", getConfig_http_proxy_port()); prop.setProperty("http.proxySet","true"); prop.setProperty("http.proxyHost",getConfig_http_proxy_url()); prop.setProperty("http.proxyPort",getConfig_http_proxy_port()); prop.setProperty("https.proxyHost", getConfig_http_proxy_url()); prop.setProperty("https.proxyPort", getConfig_http_proxy_port()); } else { prop.remove("proxySet"); prop.remove("proxyHost"); prop.remove("proxyPort"); prop.remove("http.proxySet"); prop.remove("http.proxyHost"); prop.remove("http.proxyPort"); prop.remove("https.proxyHost"); prop.remove("https.proxyPort"); } Authenticator.setDefault(new AuthImpl()); */ /*NSL20070507 No need to change the JVM property if(!HttpMessageContext.emptyString(keyStoreFile)) { prop.put("javax.net.ssl.keyStore", keyStoreFile); prop.put("javax.net.ssl.keyStorePassword", JavaKeyStoreHandler.getTrustStorePassword(keyStorePassword)); } if (!HttpMessageContext.emptyString(trustStoreFile)) { prop.put("javax.net.ssl.trustStore", trustStoreFile); prop.put("javax.net.ssl.trustStorePassword", trustStorePassword); }*/ /*NSL20070112 context.Debug("GNHttpConnection [connect]" + "Connecting URL(" + url + ") timeout[" + timeout +" s]"); myURLobject = new URL(url); uc = myURLobject.openConnection(); */ /*}*/ context.Debug( "GNHttpConnection [connect]" + "Connecting URL(" + url + ") timeout[" + timeout + " s]"); try { myURLobject = new URL(url); List<Proxy> proxyList = findProxy(myURLobject.toURI()); if (proxyList != null && !proxyList.isEmpty()) { for (Proxy proxy : proxyList) { try { uc = myURLobject.openConnection(proxy); break; } catch (Exception ex) { } } } if (uc == null) { uc = myURLobject.openConnection(); } } catch (MalformedURLException ex) { context.Warn("GNHttpConnection [connect] Malformed URL: " + url, ex); } catch (URISyntaxException ex) { context.Warn("GNHttpConnection [connect] Invalid URI: " + myURLobject, ex); } connection = (HttpURLConnection) uc; context.Debug("GNHttpConnection [connect] Connection created"); if (connection instanceof HttpsURLConnection) { context.Debug("GNHttpConnection [connect] Https Connection"); HttpsURLConnection https = (HttpsURLConnection) connection; // SSLSocketFactory factory = null; SSLSocketFactory factory = getSSLSocketFactory(); // NSL20070507 if (!authenticateServer) { // factory = new NoAuthSSLSocketFactory( https.getSSLSocketFactory() ); factory = new NoAuthSSLSocketFactory(factory); // NSL20070507 } if (factory != null) { https.setSSLSocketFactory(factory); } if (!verifyServerHostname) { https.setHostnameVerifier(new NoVerificationHostnameVerifier()); } } return connection; }