by
0
6
3,025
0
Top 1% !
Popular
Famous
Tagged
Easy-to-find
Specified
Popularity: 4432nd place
This snippet is Public
Architecturex86_64
JVMjre6
LanguageJava
LicenseMIT_X11
OSWindows

How to create a DefaultHttpClient with proxy settings

This is how to create a DefaultHttpClient adding information regarding the proxy the client is using
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/426/How-to-create-a-DefaultHttpClient-with-p?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
private static DefaultHttpClient createHttpClient() { DefaultHttpClient httpClient = new DefaultHttpClient(); if (!Utils.isNullOrEmpty(proxyAddress) && (proxyPort > 0)) { HttpHost httpproxy = new HttpHost(proxyAddress, proxyPort); httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, httpproxy); } return httpClient; }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus