Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("xxx.xxx.xxx.xxx", 3128));
Authenticator.setDefault(
new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("xxxx","xxxx".toCharArray());
}
}
);
SimpleClientHttpRequestFactory simpleClientHttpRequestFactory = new SimpleClientHttpRequestFactory();
simpleClientHttpRequestFactory.setProxy(proxy);
restTemplate.setRequestFactory(simpleClientHttpRequestFactory);
11-29
1810
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-23
1470
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-21
650
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-10