使用开源项目:https://github.com/CleverTap/apns-http2
@Test public void sync_push_notification() throws CertificateException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { FileInputStream cert = new FileInputStream("/path/to/certificate.p12"); final ApnsClient client = new ApnsClientBuilder() .withProductionGateway(false) .inSynchronousMode() .withCertificate(cert) .withPassword("1")// .withDefaultTopic("") .build(); Notification n = new Notification.Builder(" ") .alertBody("jfkldsjfkls djf叫疯狂了点事叫克里夫精神科了到甲方克里斯蒂京客隆福建省考虑到叫罚款粮食甲方克里斯蒂京客隆福建省考虑到叫罚款粮食甲方克里斯蒂京客隆福建省考虑到叫罚款粮食甲方克里斯蒂京客隆福建省考虑到叫罚款粮食甲方克里斯蒂京客隆福建省考虑到叫罚款粮食甲方克里斯蒂京客隆福建省考虑到叫罚款粮食甲方克里斯蒂京客隆福建省考虑到叫罚款粮食甲方克里斯蒂京客隆福建省考虑到叫罚款粮食甲方克里斯蒂京客隆福建省考虑到叫罚款粮食甲方克里斯蒂京客隆福建省考虑到叫罚款粮食甲方省考虑到叫罚款粮食甲方省考虑到叫罚款粮食甲方克里斯蒂京客隆福建省考虑到叫罚款粮食店街鉴定费克鲁斯积分了康佳电视").build(); NotificationResponse result = client.push(n); System.out.println(result); }复制代码
pom.xml
... 复制代码... 8.1.4.v20150727 ... org.mortbay.jetty.alpn alpn-boot ${alpn-boot-version} ... maven-surefire-plugin -Xbootclasspath/p:${settings.localRepository}/org/mortbay/jetty/alpn/alpn-boot/${alpn-boot-version}/alpn-boot-${alpn-boot-version}.jar org.apache.maven.plugins maven-compiler-plugin
Table 15.1. ALPN vs. OpenJDK versions
OpenJDK version ALPN version 1.7.0u40 7.1.0.v20141016
1.7.0u45 7.1.0.v20141016
1.7.0u51 7.1.0.v20141016
1.7.0u55 7.1.0.v20141016
1.7.0u60 7.1.0.v20141016
1.7.0u65 7.1.0.v20141016
1.7.0u67 7.1.0.v20141016
1.7.0u71 7.1.2.v20141202
1.7.0u72 7.1.2.v20141202
1.7.0u75 7.1.3.v20150130
1.7.0u76 7.1.3.v20150130
1.7.0u79 7.1.3.v20150130
1.7.0u80 7.1.3.v20150130
1.8.0 8.1.0.v20141016
1.8.0u05 8.1.0.v20141016
1.8.0u11 8.1.0.v20141016
1.8.0u20 8.1.0.v20141016
1.8.0u25 8.1.2.v20141202
1.8.0u31 8.1.3.v20150130
1.8.0u40 8.1.3.v20150130
1.8.0u45 8.1.3.v20150130
1.8.0u51 8.1.4.v20150727
1.8.0u60 8.1.5.v20150921
1.8.0u65 8.1.6.v20151105
1.8.0u66 8.1.6.v20151105
1.8.0u71 8.1.7.v20160121
1.8.0u72 8.1.7.v20160121
1.8.0u73 8.1.7.v20160121
1.8.0u74 8.1.7.v20160121
1.8.0u77 8.1.7.v20160121
1.8.0u91 8.1.7.v20160121
1.8.0u92 8.1.8.v20160420
1.8.0u101 8.1.9.v20160720
1.8.0u102 8.1.9.v20160720
1.8.0u111 8.1.9.v20160720
1.8.0u112 8.1.10.v20161026
1.8.0u121 8.1.11.v20170118