ibm-bluemix-mobile-services/bms-pushnotifications-serversdk-java

https.proxy not respected

Opened this issue · 1 comments

We are running behind a corporate proxy and unable to connect to ibm cloud.

here is how we set our Proxy settings while starting tomcat
java -Dhttps.proxyHost=10.4.XX.XX -Dhttps.proxyPort=8080 -Dhttps.nonProxyHosts=*.local|localhost ... org.apache.catalina.startup.Bootstrap start

First we printing system properties:
log("https.proxyHost: " + System.getProperty('https.proxyHost')+ "\nhttps.proxyPost" + System.getProperty('https.proxyPort')+ \nhttps.nonProxyHosts"+ System.getProperty('https.nonProxyHosts'));

====> This prints proxy details correctly.

Here is how we invoke push method:
PuhNotifications.send(notification, listener)

====> This throws
c.i.m.s.java.push.PushNotifications [180] : java.net.UnknownHostException: iam.cloud.ibm.com: Name or service not know
.....
PushServerSDKException: FPSDK0004A: Error in fetching service access token
...

Possible fix:
https://github.com/ibm-bluemix-mobile-services/bms-pushnotifications-serversdk-java/blob/master/src/main/java/com/ibm/mobilefirstplatform/serversdk/java/push/PushNotifications.java#L338

HttpClient should be built with system properties

- httpClient = HttpClients.custom().setSSLContext(sslContext).build();
+ httpClient = HttpClients.custom().useSystemProperties().setSSLContext(sslContext).build(); 

Please advise.

Hi @prasad-1210 ,

It seems like your firewall might be blocking outbound access to the endpoint .
Please check your firewall and proxy settings.