Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

NBIA-Download-Manager: Use system proxy, if available. #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.ProxySelector;
import java.net.URL;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
Expand All @@ -43,6 +44,7 @@
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.conn.ssl.TrustStrategy;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.ProxySelectorRoutePlanner;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.BasicHttpParams;
Expand Down Expand Up @@ -145,7 +147,7 @@ public static void main(String[] args) {

private static List<String> connectAndReadFromURL(URL url, String fileName) {
List<String> data = null;
HttpClient httpClient = null;
DefaultHttpClient httpClient = null;
TrustStrategy easyStrategy = new TrustStrategy() {
@Override
public boolean isTrusted(X509Certificate[] certificate, String authType)
Expand All @@ -169,6 +171,7 @@ public boolean isTrusted(X509Certificate[] certificate, String authType)
HttpConnectionParams.setConnectionTimeout(httpParams, 50000);
HttpConnectionParams.setSoTimeout(httpParams, new Integer(12000));
httpClient = new DefaultHttpClient(ccm,httpParams);
httpClient.setRoutePlanner(new ProxySelectorRoutePlanner(schemeRegistry, ProxySelector.getDefault()));
// // Additions by lrt for tcia -
// // attempt to reduce errors going through a Coyote Point Equalizer load balance switch
httpClient.getParams().setParameter("http.socket.timeout", new Integer(12000));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ProxySelector;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.URL;
Expand Down Expand Up @@ -43,6 +44,7 @@
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.conn.ssl.TrustStrategy;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.ProxySelectorRoutePlanner;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.BasicHttpParams;
Expand Down Expand Up @@ -184,6 +186,7 @@ public boolean isTrusted(X509Certificate[] certificate,
HttpConnectionParams.setSoTimeout(httpParams, new Integer(12000));
ClientConnectionManager ccm = new ThreadSafeClientConnManager(schemeRegistry);
DefaultHttpClient httpClient = new DefaultHttpClient(ccm, httpParams);
httpClient.setRoutePlanner(new ProxySelectorRoutePlanner(schemeRegistry, ProxySelector.getDefault()));

// Additions by lrt for tcia -
// attempt to reduce errors going through a Coyote Point Equalizer load
Expand Down