First of all, proxy server is a server that acts as an intermediary for requests from clients seeking resources from other server (or Internet). Usually companies' Internet connection facility use proxy to make it possible to control their employees' browsing activities, such as:
- Define someone's bandwidth limit for a specific period
- Define a blacklist of websites, within a specific time schedule or not
- Storing employees' browsing history log
- Storing employees' chatting history log
By adding these 3 JVM arguments to java, your application will use the proxy network to create HTTP requests:
- http.useProxy=true
- http.proxyHost=[domain or IP]
- http.proxyPort=[port number]
- http.nonProxyHosts=[regex of proxy exclusions]
java -Dhttp.useProxy=true -Dhttp.proxyHost=10.1.1.2 -Dhttp.proxyPort=8877 -Dhttp.nonProxyHosts=127.0.0.1|localhost -jar testsomething.jar
For HTTPS, the arguments are:
- https.proxyHost
- https.proxyPort
- http.nonProxyHosts
- ftp.proxyHost
- ftp.proxyPort
- ftp.nonProxyHosts
If the proxy network is a SOCKS v5 Proxy, then again it can be done by using JVM arguments:
- socksProxyHost=[domain or IP]
- socksProxyPort=[port number]
- java.net.socks.username=[the username]
- java.net.socks.password=[the password]
java -DsocksProxyHost=10.1.1.2 -DsocksProxyPort=8877 -Djava.net.socks.username=alibaba -Djava.net.socks.password=secret
For further information:
Networking Properties reference from sun.java.com
Java Networking and Proxies from sun.java.com
14 comments: (+add yours?)
Thx, concise summary with useful examples!
excellent tips
How does one specify username and password for the http proxy server without touching the code ?
Thank you so much. Saved the day.
Thank you.
Saved my day too.
I am doing a report on this subject. Your article is full of really useful information. I will make sure to come back to check out your posts for my next report. visit website
I was very impressed by this post, this site has always been pleasant news Thank you very much for such an interesting post, and I meet them more often then I visited this site. privacyonline
I hope you will share such type of impressive contents again with us so that we can utilize it and get more advantage. get more privacy
Good composed article. It will be steady to any individual who uses it, including me. Continue doing what you are doing – can'r hold up to peruse more posts. lemigliorivpn
Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info vpnveteran.com
Amazingly accommodating post. This is my first time i visit here. I found such an extensive number of captivating stuff in your blog especially its trade. Genuinely its unprecedented article. Keep it up. meer informatie
This is an amazing content Instahard Pills
Glad I'm stumbled upon to this blog, the content is very information thanks for sharing such piece of knowledge with us.
check out the RangeXTD Reviews
the Best Wifi Booster
The Research you have did on this topic, is really appreciable, thanks for posting this article, Keep it UP.
SoundPRO Sport Wireless Earphone Review
NanoSecure Review
Handsan Wrist Wearable Hand Sanitizer
Post a Comment