Skip to content

Commit 5e47b52

Browse files
committed
Merge pull request #22 from boly38/master
gateway proxy http client now use ProxySelectorRoutePlanner
2 parents bab3a0d + 2539456 commit 5e47b52

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/com/microsoft/azure/documentdb/GatewayProxy.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import java.io.IOException;
88
import java.io.UnsupportedEncodingException;
9+
import java.net.ProxySelector;
910
import java.net.URI;
1011
import java.net.URISyntaxException;
1112
import java.net.URLEncoder;
@@ -30,6 +31,7 @@
3031
import org.apache.http.client.methods.HttpRequestBase;
3132
import org.apache.http.impl.client.DefaultHttpClient;
3233
import org.apache.http.impl.conn.PoolingClientConnectionManager;
34+
import org.apache.http.impl.conn.ProxySelectorRoutePlanner;
3335
import org.apache.http.impl.conn.SchemeRegistryFactory;
3436
import org.apache.http.params.HttpConnectionParams;
3537
import org.apache.http.params.HttpParams;
@@ -154,7 +156,13 @@ private HttpClient getHttpClient(boolean isForMedia) {
154156
* @return the created HttpClient
155157
*/
156158
private HttpClient createHttpClient(boolean isForMedia) {
157-
HttpClient httpClient = new DefaultHttpClient(this.connectionManager);
159+
ProxySelectorRoutePlanner ps = new ProxySelectorRoutePlanner(
160+
SchemeRegistryFactory.createDefault(), ProxySelector.getDefault());
161+
162+
DefaultHttpClient defaultHttpClient = new DefaultHttpClient(this.connectionManager);
163+
defaultHttpClient.setRoutePlanner(ps);
164+
165+
HttpClient httpClient = defaultHttpClient;
158166
HttpParams httpParams = httpClient.getParams();
159167

160168
if (isForMedia) {

0 commit comments

Comments
 (0)