title: Apache HttpClient 4.1 - Proxy Settings
body: <p>I am trying to POST some parameters to a server, but I need to set up the proxy. can you help me to to sort it "setting the proxy" part of my code ?</p>
  
  <pre class="lang-java prettyprint-override"><code>HttpHost proxy = new HttpHost("xx.x.x.xx");
  
  DefaultHttpClient httpclient = new DefaultHttpClient();
  
  httpclient.getParams().setParameter("3128",proxy);
  
  
  HttpPost httpost = new HttpPost(url);
  List&lt;NameValuePair&gt; nvps = new ArrayList&lt;NameValuePair&gt;();
  
  nvps.add(new BasicNameValuePair("aranan", song));
  
  httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
  
  HttpResponse response = httpclient.execute(httpost);
  HttpEntity entity = response.getEntity();
  System.out.println("Request Handled?: " + response.getStatusLine());
  
  in = entity.getContent();
  
  httpclient.getConnectionManager().shutdown();
  </code></pre>