We use 2 SIMILAR Microsoft ISA Proxy Server 2003 to connect to internet. Each Proxy has different Login style, as below :
Server-1 : nt-domain\\alan Server-2 : alan@
Using apache-commons httpClient (version 3), I have the following code. It isn't tested well (if it is at all), but I think it worked once.. :) This is in case you can modify the programs.. if they are some 3rd party packages, nothing you can do.
String proxyHost = System.getProperty("https.proxyHost");
int proxyPort = 0;
try {
proxyPort = Integer.parseInt(System
.getProperty("https.proxyPort"));
} catch (Exception ex) {
//
}
System.setProperty("java.net.useSystemProxies", "true");
ProxySelector ps = ProxySelector.getDefault();
List proxyList = ps.select(new URI(targetUrl));
Proxy proxy = proxyList.get(0);
if (proxy != null) {
InetSocketAddress addr = ((InetSocketAddress) proxy
.address());
if (addr != null) {
proxyHost = addr.getHostName();
proxyPort = addr.getPort();
}
}
boolean useProxy = proxyHost != null && proxyHost.length() > 0;
if (useProxy) {
httpClient.getHostConfiguration().setProxy(proxyHost,
proxyPort);
}