Integrations / Language
Use Proxys with Java
Use Proxys with Java's HttpClient.
Steps
- Set a ProxySelector and an Authenticator for the proxy credentials.
- Allow Basic auth for HTTPS tunnels: -Djdk.http.auth.tunneling.disabledSchemes=""
HttpClient client = HttpClient.newBuilder()
.proxy(ProxySelector.of(new InetSocketAddress("gw.proxys.co", 8000)))
.authenticator(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("USERNAME-country-us", "PASSWORD".toCharArray());
}
}).build();Before you start
Replace USERNAME and PASSWORD with a sub-user's credentials from the dashboard. Change -country-us to the country you need, or remove it for a random location. See targeting options for city, ASN and sticky sessions.