Java bypass proxy programmatically apache -


background

i using aws java sdk sqs read message local queue. using elasticmq local queue.

@test public void readmessagefromqueue() {      awscredentialsproviderchain credentialsprovider = new awscredentialsproviderchain(new defaultawscredentialsproviderchain());     clientconfiguration clientconfiguration = new clientconfiguration();      amazonsqsclient sqsclient = new amazonsqsclient(credentialsprovider, clientconfiguration);     sqsclient.setendpoint("http://127.0.0.1:9324/queue");     receivemessagerequest receivemessagerequest = new receivemessagerequest("queue1").withmaxnumberofmessages(10);      receivemessageresult receivemessageresult = sqsclient.receivemessage(receivemessagerequest);     list<message> sqsmessages = receivemessageresult.getmessages();  } 

this works until connected internet via proxy (at work)

i 504 tries route localhost via proxy.

question

how bypass proxy localhost programmatically in java?

i have tried following no avail

system.setproperty("no_proxy", "127.0.0.1"); system.setproperty("proxyset", "false"); system.setproperty("proxyhost", ""); system.setproperty("proxyport", ""); system.setproperty("no_proxy", "127.0.0.1"); system.setproperty("http.no_proxy", "127.0.0.1"); system.setproperty("http.proxyset", "false"); 

the thing works adding 127.0.0.1 bypass proxy in mac network settings.

localhost in bypass proxy

i have tried localhost (oppose 127.0.0.1)

any ideas?

have tried setting http.nonproxyhosts?

string nonproxyhosts = system.getproperty("http.nonproxyhosts"); nonproxyhosts = nonproxyhosts == null ? "127.0.0.1" : nonproxyhosts + "|127.0.0.1"; system.setproperty("http.nonproxyhosts", nonproxyhosts); 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -