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

IBM Cloud Mobile Services - Server side Java SDK for IBM Cloud Push Notifications Service
Apache License 2.0
3 stars 6 forks source link

https.proxy not respected #55

Open prasad-1210 opened 4 years ago

prasad-1210 commented 4 years ago

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.

myselfneerav commented 4 years ago

Hi @prasad-1210 ,

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