Home » Tip Bank » Java
  • Comment on this Article
Language: Java
Expertise: Intermediate
Oct 2, 2019
  • facebook
  • twitter
  • in
  • Email

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Watch

Setting a Proxy in Java

Let's assume that we have a proxy at address proxy.host:8888. We can set up this proxy via the JDK 11 HttpClient as follows:

HttpClient client = HttpClient.newBuilder()
   .proxy(ProxySelector.of(new InetSocketAddress("proxy.host", 8888)))
   .build();
Octavia Anghel
 
Submit a Tip
Browse "Java" Tips
Browse All Tips
htmlgoodies.com
html-color-codes.info