public URLConnection openUrl(URL url) throws IOException { if (name == null) { URLConnection urlConnection = url.openConnection(); connect(urlConnection); return urlConnection; } if (noProxyFor != null) { StringTokenizer tokenizer = new StringTokenizer(noProxyFor, ","); while (tokenizer.hasMoreTokens()) { String noProxyHost = tokenizer.nextToken().trim(); if (noProxyHost.contains("*")) { if (url.getHost().trim().contains(noProxyHost.replaceAll("\\*", ""))) { return url.openConnection(Proxy.NO_PROXY); } } else if (url.getHost().trim().equals(noProxyHost)) { return url.openConnection(Proxy.NO_PROXY); } } } URLConnection urlConnection = url.openConnection(createProxy()); if (isAuthNeeded()) { String credentials = getUserName() + ":" + getPassword(); String encoded = new String(Base64.encodeBase64(credentials.getBytes())); urlConnection.setRequestProperty("Proxy-Authorization", "Basic " + encoded); } connect(urlConnection); return urlConnection; }
if (proxyConfig.isAuthNeeded()) { String credentials = proxyConfig.getUserName() + ":" + proxyConfig.getPassword(); String encoded = new String(Base64.encodeBase64(credentials.getBytes()));
if (proxyConfig.isAuthNeeded()) { String credentials = proxyConfig.getUserName() + ":" + proxyConfig.getPassword(); String encoded = new String(Base64.encodeBase64(credentials.getBytes()));
if (proxyConfig.isAuthNeeded()) { String credentials = proxyConfig.getUserName() + ":" + proxyConfig.getPassword(); String encoded = new String(Base64.encodeBase64(credentials.getBytes()));