Created
August 2, 2018 12:33
-
-
Save omernaci/9da23ec0a672e7a3590156ddd94799b5 to your computer and use it in GitHub Desktop.
Apache HttpComponents Proxy Config(v4.5.5)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try (ClosableHttpClient httpClient = HttpClients.createDefault()) { | |
HttpHost proxy = new HttpHost("proxy host", 3128); | |
RequestConfig config = RequestConfig.custom() | |
.setProxy(proxy) | |
.build(); | |
HttpGet httpget = new HttpGet("/path"); | |
httpget.setConfig(config); | |
... | |
... | |
System.out.println("Executing request " + httpget.getRequestLine() + " to " + target + " via " + proxy); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment