Apply patch from Pavlo Vasylchenko
This commit is contained in:
Timothy Bish 2015-06-19 16:28:43 -04:00
parent a35be76ff3
commit d919db5e3d
1 changed files with 7 additions and 0 deletions

View File

@ -47,6 +47,8 @@ import org.apache.http.client.methods.HttpOptions;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.params.ConnRoutePNames;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;
@ -325,6 +327,11 @@ public class HttpClientTransport extends HttpTransportSupport {
HttpHost proxy = new HttpHost(getProxyHost(), getProxyPort());
client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
if (client.getConnectionManager().getSchemeRegistry().get("http") == null) {
client.getConnectionManager().getSchemeRegistry().register(
new Scheme("http", getProxyPort(), PlainSocketFactory.getSocketFactory()));
}
if(getProxyUser() != null && getProxyPassword() != null) {
client.getCredentialsProvider().setCredentials(
new AuthScope(getProxyHost(), getProxyPort()),