"连接被拒绝"向GCM服务器发送推送通知时发生异常

时间:2016-05-03 07:03:49

标签: java android push-notification google-cloud-messaging

有时在向GCM服务器发送推送通知时获取连接拒绝异常。

推送通知代码:

getSender().send(message, "registrationIDs", 5);

以上行抛出连接拒绝异常。

堆栈跟踪:

[java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
        at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
        at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
        at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1104)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:998)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1282)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1257)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
        at com.google.android.gcm.server.Sender.post(Sender.java:479)
        at com.google.android.gcm.server.Sender.post(Sender.java:458)
        at com.google.android.gcm.server.Sender.sendNoRetry(Sender.java:170)
        at com.google.android.gcm.server.Sender.send(Sender.java:121)
        at com.novell.zenworks.mobile.pushnotification.GCMPushNotificationSender.sendNotification(GCMPushNotificationSender.java:164)
        at com.novell.zenworks.loader.modules.DoMobilePushNotificationQueueActionHandler.sendPushNotificationToMobileDevices(DoMobilePushNotificationQueueActionHandler.java:451)
        at com.novell.zenworks.loader.modules.DoMobilePushNotificationQueueActionHandler.processAction(DoMobilePushNotificationQueueActionHandler.java:361)
        at com.novell.zenworks.loader.modules.queue.runner.QueueThreadWorker.processAction(QueueThreadWorker.java:220)
        at com.novell.zenworks.loader.modules.queue.runner.QueueThreadWorker.run(QueueThreadWorker.java:146)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

0 个答案:

没有答案