How to connect to the Internet through a proxy? -


i have written below code access web page , run in ubuntu.

how fix this? have tried suggested fixes on internet, still can't figure out solution.

a 407 response means "proxy authentication required", described here.

now appear setting proxy user , password in system properties, apparently not working. can think of couple of explanations:

  • you setting properties late. properties read default proxyselector , authenticator initializing. if set them late, won't respected. try setting properties using -d... options.

  • you using wrong proxy username , password.

  • the proxy expecting proxy authentication details in different form being supplied. take @ headers in response failed request. there should "proxy-authenticate" header includes "challenge".


if approach doesn't work, alternative implement proxy selection , authentication programatically implementing , registering own proxyselector , authenticator classes.


followup

i included proxyauthenticator class , now, "java.net.protocolexception: server redirected many times (20)" thrown.

somehow, application has gotten redirection loop.

i'm still not convinced set proxy properties enough.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -