What steps will reproduce the problem? 1.public class PushTestClass2 {
public void pushMessage() {
ApnsService service = null;
try {
// get the certificate
// ~/Desktop/CertKey.pem
InputStream certStream = this.getClass().getClassLoader().getResourceAsStream("/opt/cert/CertKey.pem");
service = APNS.newService().withCert(certStream, "PasswordHere").withSandboxDestination().build();
service.start();
try {
// so that we get the number of updates to display it as the badge.
PayloadBuilder payloadBuilder = APNS.newPayload();
payloadBuilder = payloadBuilder.badge(44).alertBody("some message you want to send here");
// check if the message is too long (it won't be sent if it is)
//and trim it if it is.
if (payloadBuilder.isTooLong()) {
payloadBuilder = payloadBuilder.shrinkBody();
}
String payload = payloadBuilder.build();
String token = "DeviceTokenToSendNotificationToGoesHere";
service.push(token, payload);
} catch (Exception ex) {
// some logging stuff
}
} catch (Exception ex) {
// more logging
} finally {
// check if the service was successfull initialized and stop it here, if it was
if (service != null) {
service.stop();
}
}
}
} 2. 3.
What is the expected output? What do you see instead? Expect Notification to be sent through to device, but get SSL exceptions instead.
What version of the product are you using? On what operating system? JDK 7 and APNS 0.2.3 Maven Wildfly 8.2. MAC OSX
Please provide any additional information below.
I have tested connecting with the certificates using OPENSSL and the certificates check out fine.
I understand this is an INFO error:
14:37:54,419 INFO [com.notnoop.apns.internal.ApnsConnectionImpl] (Thread-2044) Exception while waiting for error code: javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake at sun.security.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1476) [jsse.jar:1.7.0_60-ea] at sun.security.ssl.AppInputStream.read(AppInputStream.java:103) [jsse.jar:1.7.0_60-ea] at java.io.InputStream.read(InputStream.java:101) [rt.jar:1.7.0_60-ea] at com.notnoop.apns.internal.ApnsConnectionImpl$1MonitoringThread.run(ApnsConnectionImpl.java:114) [apns-0.2.3.jar:] Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
Caused by: java.io.EOFException: SSL peer shut down incorrectly at sun.security.ssl.InputRecord.read(InputRecord.java:482) [jsse.jar:1.7.0_60-ea] at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927) [jsse.jar:1.7.0_60-ea] ... 79 more
14:37:57,006 INFO [com.notnoop.apns.internal.ApnsConnectionImpl] (Thread-2045) Exception while waiting for error code: java.net.SocketException: Socket is closed
Th Error in JBOSS LOG:
14:37:59,158 ERROR [com.notnoop.apns.internal.ApnsConnectionImpl] (EJB default - 3) Couldn't send message after 3 retries.Message(Id=1; Token=54376E33446287C71DD37BCDE7A252A89838CDCFA97617B51223D07BBB5020C0; Payload={"aps":{"alert":"some message you want to send here","badge":44}}): javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
Caused by: java.io.EOFException: SSL peer shut down incorrectly at sun.security.ssl.InputRecord.read(InputRecord.java:482) [jsse.jar:1.7.0_60-ea] at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927) [jsse.jar:1.7.0_60-ea] ... 79 more
I have been on this for 4 days to no avail. ANY indication in the right path would be greatly appreciated!
Ty in advance.
Comment #1
Posted on Apr 23, 2015 by Happy HippoIssue has been resolved. Turns out i was using a Production profile with Development certificates.
Sorry for any inconvenience this may have caused!
Comment #2
Posted on Aug 14, 2015 by Happy BearCan you explain, how you had resolved the problem
Status: New
Labels:
Type-Defect
Priority-Medium