public List<Proxy> select(URI uri) {
// argument check
if (null == uri) {
// luni.4D=Argument must not be null
throw new IllegalArgumentException(Messages.getString("luni.4D")); //$NON-NLS-1$
}
// check scheme
String scheme = uri.getScheme();
if (null == scheme) {
throw new IllegalArgumentException();
}
String host = uri.getHost();
Proxy proxy = Proxy.NO_PROXY;
if ("http".equals(scheme)) { //$NON-NLS-1$
proxy = selectHttpProxy(host);
} else if ("https".equals(scheme)) { //$NON-NLS-1$
proxy = selectHttpsProxy();
} else if ("ftp".equals(scheme)) { //$NON-NLS-1$
proxy = selectFtpProxy(host);
} else if ("socket".equals(scheme)) { //$NON-NLS-1$
proxy = selectSocksProxy();
}
List< Proxy > proxyList = new ArrayList< Proxy >(1);
proxyList.add(proxy);
return proxyList;
}
|