CleverTap/apns-http2

Unexpected End of Stream on Connection

jlaskowski opened this issue · 1 comments

Not sure why I'm getting this response from the Apple Dev APNS from basically using the "Using Provider Certificate" example in the README:

Sending: {"aps":{"alert":{"body":"Hello World"}}}

NotificationResponse{error=null, httpStatusCode=-1, responseBody='null', cause=java.io.IOException: unexpected end of stream on Connection{api.development.push.apple.com:443, proxy=DIRECT hostAddress=api.development.push.apple.com/17.188.138.73:443 cipherSuite=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 protocol=http/1.1}}

try {
			FileInputStream cert = new FileInputStream("/Users/Jim/Desktop/Sec/adhoc_aps_key.p12");
			final ApnsClient client = new ApnsClientBuilder()
			        .withDevelopmentGateway()
					.inSynchronousMode()
			        .withCertificate(cert)
			        .withPassword("********")
			        .build();
	
			Notification n = new Notification.Builder("bed934c1196680f82dbb151a93e761f54ed3d7de7e952f00fc628d2c6c55655c")
					.alertBody("Hello World").build();
			System.out.println("Sending: " + n.getPayload());
			NotificationResponse result = client.push(n);
			System.out.println(result);

		} catch (UnrecoverableKeyException | KeyManagementException | CertificateException | NoSuchAlgorithmException
				| KeyStoreException | IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 

Ok, I saw in a different project that someone else ran into the same problem and it's because we can't read instructions. The readme says to include ALPN jar. Sorry!