HttpClient httpClient = new HttpClient(); //设置代理服务器的ip地址和端口 httpClient.getHostConfiguration().setProxy("10.0.3.99", 80); //使用抢先认证 httpClient.getParams().setAuthenticationPreemptive(true); //如果代理需要密码验证,这里设置用户名密码 httpClient.getState().setProxyCredentials(AuthScope.ANY, new UsernamePasswordCredentials("cnblogs.com","jay"));