Created
October 16, 2017 13:26
-
-
Save salrashid123/a851388e1af99349c7269fada18f0ca5 to your computer and use it in GitHub Desktop.
proxy-ApacheTransport
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JacksonFactory jsonFactory = new JacksonFactory(); | |
HttpHost proxy = new HttpHost("127.0.0.1",3128); | |
DefaultHttpClient httpClient = new DefaultHttpClient(); | |
httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); | |
httpClient.addRequestInterceptor(new HttpRequestInterceptor(){ | |
@Override | |
public void process(org.apache.http.HttpRequest request, HttpContext context) throws HttpException, IOException { | |
if (request.getRequestLine().getMethod().equals("CONNECT")) | |
request.addHeader(new BasicHeader("Proxy-Authorization","Basic dXNlcjE6dXNlcjE=")); | |
} | |
}); | |
mHttpTransport = new ApacheHttpTransport(httpClient); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment