Quick answer
To use SocksNode residential proxies in Java, configure java.net.http.HttpClient with a ProxySelector for global.socksnode.com:9000 and an Authenticator supplying your username token and password. Use port 9000 for rotating IPs or 10000 with a session token for sticky IPs, and set geo targeting in the username.
Before you start
SocksNode offers residential proxies across 195+ countries over HTTP, HTTPS, and SOCKS5 with username/password auth. Generate credentials for free in the dashboard proxy generator; only routed traffic consumes your prepaid bandwidth (from 5 GB for $4.50, non-expiring on flexible plans).
By default the JDK disables Basic proxy authentication over HTTPS tunnels. Clear jdk.http.auth.tunneling.disabledSchemes so credentials are sent to the proxy.
Configure the proxy in Java
Build a client with proxy and authenticator:
Then send a request to https://api.ipify.org and read the body. Start the JVM with -Djdk.http.auth.tunneling.disabledSchemes="" so proxy Basic auth works over HTTPS. Change the country token to target any of 195+ countries.
import java.net.Authenticator;
import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;
import java.net.ProxySelector;
import java.net.http.HttpClient;
public class ProxyClient {
public static void main(String[] args) {
HttpClient client = HttpClient.newBuilder()
.proxy(ProxySelector.of(new InetSocketAddress("global.socksnode.com", 9000)))
.authenticator(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("USERNAME-country-us", "PASSWORD".toCharArray());
}
})
.build();
}
}Rotating vs sticky sessions
Rotating sessions rotate the exit IP each request on HTTP port 9000, well suited to distributing many requests across residential exits.
Sticky sessions hold one IP from 1 minute up to 24 hours on HTTP port 10000. Use a token like USERNAME-country-us-session-svc4-lifetime-45 in the Authenticator username to keep one IP for a 45-minute session.
Geo targeting with username tokens
Targeting is expressed in the username token: country across 195+ countries, US state and city, or ASN/ISP within a country. Only the username string changes between regions.
Use the network lawfully, respect the target site's terms of service, and stay within applicable law and reasonable request rates.
See also
Frequently asked questions
Why does proxy auth fail over HTTPS in Java?
The JDK disables Basic auth on HTTPS tunnels by default. Launch with -Djdk.http.auth.tunneling.disabledSchemes="" so the username token and password are sent.
How do I keep the same IP across requests?
Use port 10000 and a session token like USERNAME-country-us-session-abc-lifetime-45 in the Authenticator username to hold one IP for up to 24 hours.
Can I use SOCKS5 from Java?
Yes. Configure a SOCKS proxy on ports 11000 (rotating) or 12000 (sticky); many HTTP clients and libraries accept SOCKS5 with username/password auth.
How do I target a specific country?
Set the country token in the username, such as USERNAME-country-nl, choosing from 195+ countries plus US state, city, and ASN targeting.
Do extra credentials consume bandwidth?
No. Generating credentials is free; only the traffic your client routes through the proxy consumes prepaid bandwidth.


