http://www.jianshu.com/p/f38a62efaa96

1
2
3
4
5
6
7
8
9
  
HttpHost proxy = new HttpHost("localhost",8888);
  
CloseableHttpClient httpclient = HttpClients.custom()
  
.setDefaultRequestConfig(RequestConfig.custom()
  
.setProxy(proxy).build()).build();