效果:
代码:
public class TestMain {
public static void main(String[] args){
HttpRequest httpRequest = HttpRequest.get("https://www.youtube.com").timeout(30000);
httpRequest.setProxy(new Proxy(Proxy.Type.HTTP,new InetSocketAddress("127.0.0.1",10809)));
String body = httpRequest.execute().body();
System.out.println(body);
}
}
如何获取代理端口: