├── .travis.yml
├── .gitignore
├── src
├── main
│ └── java
│ │ └── cn
│ │ └── teaey
│ │ └── apns4j
│ │ ├── keystore
│ │ ├── KeyStoreType.java
│ │ ├── InvalidKeyStoreTypeException.java
│ │ ├── InvalidKeyStorePasswordException.java
│ │ ├── InvalidKeyStoreException.java
│ │ ├── InvalidKeyStoreFormatException.java
│ │ └── KeyStoreGetter.java
│ │ ├── protocol
│ │ ├── Protocal.java
│ │ ├── InvalidErrorResponse.java
│ │ ├── InvalidDeviceTokenException.java
│ │ ├── Payload.java
│ │ ├── ListMap.java
│ │ ├── ErrorResp.java
│ │ ├── JsonParser.java
│ │ └── ApnsPayload.java
│ │ ├── network
│ │ ├── async
│ │ │ ├── AsyncServiceShutdownException.java
│ │ │ ├── PayloadSender.java
│ │ │ ├── ApnsFuture.java
│ │ │ └── ApnsService.java
│ │ ├── Channel.java
│ │ ├── ApnsChannelFactory.java
│ │ ├── ApnsGateway.java
│ │ ├── SecuritySocketFactory.java
│ │ └── ApnsChannel.java
│ │ ├── ApnsException.java
│ │ ├── Apns4j.java
│ │ └── ApnsHelper.java
└── test
│ └── java
│ └── cn
│ └── teaey
│ └── apns4j
│ ├── BadgeTest.java
│ ├── TestConts.java
│ ├── ActionButtonTest.java
│ ├── AlertTest.java
│ └── MainTest.java
├── README.md
├── pom.xml
├── LICENSE
└── LICENSE.txt
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 |
3 | # Package Files #
4 | *.jar
5 | *.war
6 | *.ear
7 | .idea
8 | .idea/**
9 | *.iml
10 | *.jar
11 | target
12 | target/**
13 | *.ipr
14 | *.iws
15 | *.p12
--------------------------------------------------------------------------------
/src/main/java/cn/teaey/apns4j/keystore/KeyStoreType.java:
--------------------------------------------------------------------------------
1 | package cn.teaey.apns4j.keystore;
2 |
3 | /**
4 | * @author teaey(xiaofei.wxf)
5 | * @since 1.0.3
6 | */
7 | public enum KeyStoreType {
8 | PKCS12,
9 | JKS
10 | }
11 |
--------------------------------------------------------------------------------
/src/test/java/cn/teaey/apns4j/BadgeTest.java:
--------------------------------------------------------------------------------
1 | package cn.teaey.apns4j;
2 |
3 | import cn.teaey.apns4j.protocol.ApnsPayload;
4 | import org.junit.After;
5 | import org.junit.Test;
6 |
7 | /**
8 | * @author teaey(xiaofei.wxf)
9 | * @since 1.0.3
10 | */
11 | public class BadgeTest {
12 |
13 | @Test
14 | public void badge() {
15 | ApnsPayload payload = Apns4j.newPayload()
16 | .badge(4);
17 | System.out.println(payload.toJsonString());
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/test/java/cn/teaey/apns4j/TestConts.java:
--------------------------------------------------------------------------------
1 | package cn.teaey.apns4j;
2 |
3 | /**
4 | * @author teaey(xiaofei.wxf)
5 | * @since 1.0.3
6 | */
7 | public interface TestConts {
8 | String deviceToken = "32252032dc502ded559698b085227799af59abd4d8343f4027012f156f2edc23";
9 | String deviceToken2 = "a9d04e8d98adb00fa1a62992901b7990f03ac9ba200635c85cbcfdeb464d85ee";
10 |
11 | String keyStorePath = "/Users/teaey/Documents/apns4j/aps_development.p12";
12 | String keyStorePwd = "1234";
13 | }
14 |
--------------------------------------------------------------------------------
/src/test/java/cn/teaey/apns4j/ActionButtonTest.java:
--------------------------------------------------------------------------------
1 | package cn.teaey.apns4j;
2 |
3 | import cn.teaey.apns4j.protocol.ApnsPayload;
4 | import org.junit.After;
5 | import org.junit.Test;
6 |
7 | /**
8 | * @author teaey(xiaofei.wxf)
9 | * @since 1.0.3
10 | */
11 | public class ActionButtonTest {
12 |
13 | @Test
14 | public void actionLocKey() {
15 | ApnsPayload apnsPayload = Apns4j.newPayload()
16 | .alertBody("Push by apns4j")
17 | .alertActionLocKey("FixMe");
18 | System.out.println(apnsPayload.toJsonString());
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/test/java/cn/teaey/apns4j/AlertTest.java:
--------------------------------------------------------------------------------
1 | package cn.teaey.apns4j;
2 |
3 | import cn.teaey.apns4j.protocol.ApnsPayload;
4 | import org.junit.After;
5 | import org.junit.Test;
6 |
7 | /**
8 | * @author teaey(xiaofei.wxf)
9 | * @since 1.0.3
10 | */
11 | public class AlertTest {
12 |
13 | @Test
14 | public void alert() throws InterruptedException {
15 | //create & init notify payload
16 | ApnsPayload apnsPayload = Apns4j.newPayload()
17 | .alertTitle("Title")
18 | .alertBody("Pushed by apns4j")
19 | .extend("k", "v")
20 | .sound("default");
21 | System.out.println(apnsPayload.toJsonString());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/cn/teaey/apns4j/protocol/Protocal.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2015 The Apns4j Project
4 | * *
5 | * * The Netty Project licenses this file to you under the Apache License,
6 | * * version 2.0 (the "License"); you may not use this file except in compliance
7 | * * with the License. You may obtain a copy of the License at:
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * * License for the specific language governing permissions and limitations
15 | * * under the License.
16 | *
17 | */
18 |
19 | package cn.teaey.apns4j.protocol;
20 |
21 | import java.nio.charset.Charset;
22 |
23 | /**
24 | * @author teaey
25 | * @since 1.0.0
26 | */
27 | public class Protocal {
28 | /**
29 | * Constant DEF_CHARSET
30 | */
31 | public static final Charset DEF_CHARSET = Charset.forName("UTF-8");
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/cn/teaey/apns4j/protocol/InvalidErrorResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2015 The Apns4j Project
4 | * *
5 | * * The Netty Project licenses this file to you under the Apache License,
6 | * * version 2.0 (the "License"); you may not use this file except in compliance
7 | * * with the License. You may obtain a copy of the License at:
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * * License for the specific language governing permissions and limitations
15 | * * under the License.
16 | *
17 | */
18 |
19 | package cn.teaey.apns4j.protocol;
20 |
21 | /**
22 | * @author teaey
23 | * @since 1.0.0
24 | */
25 | public class InvalidErrorResponse extends RuntimeException {
26 | /**
27 | *
Constructor for InvalidErrorResponse.
28 | *
29 | * @param msg a {@link String} object.
30 | */
31 | public InvalidErrorResponse(String msg) {
32 | super(msg);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/cn/teaey/apns4j/network/async/AsyncServiceShutdownException.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2015 The Apns4j Project
4 | * *
5 | * * The Netty Project licenses this file to you under the Apache License,
6 | * * version 2.0 (the "License"); you may not use this file except in compliance
7 | * * with the License. You may obtain a copy of the License at:
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * * License for the specific language governing permissions and limitations
15 | * * under the License.
16 | *
17 | */
18 |
19 | package cn.teaey.apns4j.network.async;
20 |
21 | /**
22 | * @author teaey
23 | * @since 1.0.0
24 | */
25 | public class AsyncServiceShutdownException extends RuntimeException {
26 | /**
27 | *
Constructor for AsyncServiceShutdownException.
28 | *
29 | * @param msg a {@link String} object.
30 | */
31 | public AsyncServiceShutdownException(String msg) {
32 | super(msg);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Apns4j
2 |
3 | [](https://www.apache.org/licenses/LICENSE-2.0.html)
4 | [](https://travis-ci.org/teaey/apns4j)
5 |
6 | ### Quick start
7 |
8 | ```
9 |
10 | cn.teaey.apns4j
11 | apns4j
12 | 1.1.4
13 |
14 | ```
15 |
16 | ```
17 | //Step 1
18 | ApnsChannelFactory apnsChannelFactory = Apns4j.newChannelFactoryBuilder()
19 | .keyStoreMeta("${path to your keystore}")
20 | .keyStorePwd("${keystore password}")
21 | .build();
22 |
23 | //Setp 2
24 | ApnsChannel apnsChannel = apnsChannelFactory.newChannel();
25 |
26 | //Step 3 create & init notify payload
27 | ApnsPayload apnsPayload = Apns4j.newPayload()
28 | .alertTitle("Title")
29 | .alertBody("Pushed by apns4j")
30 | .sound("default");
31 |
32 | //Step 4 send via channel
33 | apnsChannel.send("${target device token}", apnsPayload);
34 |
35 | //Step 5 in the end, apnsChannel can be Recycle and Reuse
36 | apnsChannel.close();
37 | ```
38 |
39 |
40 | #### Version Control
41 |
42 | ```
43 | This project uses Semantic Versioning. Version format is X.Y.Z:
44 |
45 | X: New program version.
46 |
47 | Y: New feature or huge bug fix patch.
48 |
49 | Z: Minor fix or patch.
50 | ```
51 |
--------------------------------------------------------------------------------
/src/main/java/cn/teaey/apns4j/protocol/InvalidDeviceTokenException.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2015 The Apns4j Project
4 | * *
5 | * * The Netty Project licenses this file to you under the Apache License,
6 | * * version 2.0 (the "License"); you may not use this file except in compliance
7 | * * with the License. You may obtain a copy of the License at:
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * * License for the specific language governing permissions and limitations
15 | * * under the License.
16 | *
17 | */
18 |
19 | package cn.teaey.apns4j.protocol;
20 |
21 | /**
22 | * @author teaey
23 | * @since 1.0.0
24 | */
25 | public class InvalidDeviceTokenException extends RuntimeException {
26 | /**
27 | *
35 | *
36 | * @param msg a {@link String} object.
37 | */
38 | public InvalidDeviceTokenException(String msg) {
39 | super(msg);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/cn/teaey/apns4j/network/async/PayloadSender.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2015 The Apns4j Project
4 | * *
5 | * * The Netty Project licenses this file to you under the Apache License,
6 | * * version 2.0 (the "License"); you may not use this file except in compliance
7 | * * with the License. You may obtain a copy of the License at:
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * * License for the specific language governing permissions and limitations
15 | * * under the License.
16 | *
17 | */
18 |
19 | package cn.teaey.apns4j.network.async;
20 |
21 | /**
22 | * @author teaey
23 | * @since 1.0.0
24 | */
25 | public interface PayloadSender {
26 | /**
27 | *
send.
28 | *
29 | * @param deviceTokenBytes an array of byte.
30 | * @param payload a T object.
31 | * @return feture
32 | */
33 | ApnsFuture send(byte[] deviceTokenBytes, T payload);
34 |
35 | /**
36 | *
send.
37 | *
38 | * @param deviceTokenString a {@link String} object.
39 | * @param payload a T object.
40 | * @return feture
41 | */
42 | ApnsFuture send(String deviceTokenString, T payload);
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/cn/teaey/apns4j/ApnsException.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2015 The Apns4j Project
4 | * *
5 | * * The Netty Project licenses this file to you under the Apache License,
6 | * * version 2.0 (the "License"); you may not use this file except in compliance
7 | * * with the License. You may obtain a copy of the License at:
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * * License for the specific language governing permissions and limitations
15 | * * under the License.
16 | *
17 | */
18 |
19 | package cn.teaey.apns4j;
20 |
21 | /**
22 | * @author xiaofei.wxf
23 | */
24 | public class ApnsException extends RuntimeException {
25 | public ApnsException() {
26 | }
27 |
28 | public ApnsException(String message) {
29 | super(message);
30 | }
31 |
32 | public ApnsException(String message, Throwable cause) {
33 | super(message, cause);
34 | }
35 |
36 | public ApnsException(Throwable cause) {
37 | super(cause);
38 | }
39 |
40 | public ApnsException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
41 | super(message, cause, enableSuppression, writableStackTrace);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/test/java/cn/teaey/apns4j/MainTest.java:
--------------------------------------------------------------------------------
1 | package cn.teaey.apns4j;
2 |
3 | import cn.teaey.apns4j.network.ApnsChannel;
4 | import cn.teaey.apns4j.network.ApnsChannelFactory;
5 | import cn.teaey.apns4j.network.async.ApnsFuture;
6 | import cn.teaey.apns4j.network.async.ApnsService;
7 | import cn.teaey.apns4j.protocol.ApnsPayload;
8 | import org.junit.After;
9 | import org.junit.Test;
10 |
11 | import java.util.concurrent.ExecutionException;
12 | import java.util.concurrent.TimeUnit;
13 |
14 | /**
15 | * @author teaey(xiaofei.wxf)
16 | * @since 1.0.3
17 | */
18 | public class MainTest {
19 | static final ApnsChannelFactory apnsChannelFactory = Apns4j.newChannelFactoryBuilder().keyStoreMeta(TestConts.keyStorePath).keyStorePwd(TestConts.keyStorePwd).build();
20 | static final ApnsChannel apnsChannel = apnsChannelFactory.newChannel();
21 | static final ApnsService apnsService = new ApnsService(3, apnsChannelFactory, 3);
22 | public static void main(String[] args) {
23 | ApnsPayload apnsPayload = Apns4j.newPayload()
24 | .alertTitle("Title")
25 | .alertBody("Pushed by apns4j")
26 | .extend("k", "v")
27 | .sound("default");
28 | //send via channel
29 | apnsChannel.send(TestConts.deviceToken, apnsPayload);
30 | //send async via service
31 | ApnsFuture apnsFuture = apnsService.send(TestConts.deviceToken, apnsPayload);
32 | apnsService.shutdown(3, TimeUnit.SECONDS);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/cn/teaey/apns4j/network/Channel.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2015 The Apns4j Project
4 | * *
5 | * * The Netty Project licenses this file to you under the Apache License,
6 | * * version 2.0 (the "License"); you may not use this file except in compliance
7 | * * with the License. You may obtain a copy of the License at:
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * * License for the specific language governing permissions and limitations
15 | * * under the License.
16 | *
17 | */
18 |
19 | package cn.teaey.apns4j.network;
20 |
21 | import java.io.Closeable;
22 |
23 | /**
24 | * @author teaey
25 | * @since 1.0.0
26 | */
27 | public interface Channel extends Closeable {
28 | /**
29 | * Writes data.length bytes from the specified byte array
30 | * to this connection
31 | *
32 | * @param data an array of byte.
33 | */
34 | void send(byte[] data);
35 |
36 | /**
37 | * Reads some number of bytes from the connection and stores them into
38 | * the buffer array data. The number of bytes actually read is
39 | * returned as an integer.
40 | *
41 | * @param data an array of byte.
42 | * @return a int.
43 | */
44 | int recv(byte[] data);
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/cn/teaey/apns4j/keystore/InvalidKeyStoreTypeException.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2015 The Apns4j Project
4 | * *
5 | * * The Netty Project licenses this file to you under the Apache License,
6 | * * version 2.0 (the "License"); you may not use this file except in compliance
7 | * * with the License. You may obtain a copy of the License at:
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * * License for the specific language governing permissions and limitations
15 | * * under the License.
16 | *
17 | */
18 |
19 | package cn.teaey.apns4j.keystore;
20 |
21 | /**
22 | * @author teaey
23 | * @since 1.0.0
24 | */
25 | public class InvalidKeyStoreTypeException extends InvalidKeyStoreException {
26 | /**
27 | *
38 | *
39 | * @param e a {@link Exception} object.
40 | */
41 | public InvalidKeyStoreTypeException(Exception e) {
42 | super(e);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/cn/teaey/apns4j/keystore/InvalidKeyStorePasswordException.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2015 The Apns4j Project
4 | * *
5 | * * The Netty Project licenses this file to you under the Apache License,
6 | * * version 2.0 (the "License"); you may not use this file except in compliance
7 | * * with the License. You may obtain a copy of the License at:
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * * License for the specific language governing permissions and limitations
15 | * * under the License.
16 | *
17 | */
18 |
19 | package cn.teaey.apns4j.keystore;
20 |
21 | /**
22 | * @author teaey
23 | * @since 1.0.0
24 | */
25 | public class InvalidKeyStorePasswordException extends InvalidKeyStoreException {
26 | /**
27 | *
38 | *
39 | * @param e a {@link Exception} object.
40 | */
41 | public InvalidKeyStorePasswordException(Exception e) {
42 | super(e);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/cn/teaey/apns4j/network/ApnsChannelFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2015 The Apns4j Project
4 | * *
5 | * * The Netty Project licenses this file to you under the Apache License,
6 | * * version 2.0 (the "License"); you may not use this file except in compliance
7 | * * with the License. You may obtain a copy of the License at:
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * * License for the specific language governing permissions and limitations
15 | * * under the License.
16 | *
17 | */
18 |
19 | package cn.teaey.apns4j.network;
20 |
21 | /**
22 | * @author teaey(xiaofei.wxf)
23 | * @since 1.0.3
24 | */
25 | public final class ApnsChannelFactory {
26 | private final SecuritySocketFactory securitySocketFactory;
27 |
28 | public ApnsChannelFactory(SecuritySocketFactory securitySocketFactory) {
29 | this.securitySocketFactory = securitySocketFactory;
30 | }
31 |
32 | public SecuritySocketFactory getSecuritySocketFactory() {
33 | return securitySocketFactory;
34 | }
35 |
36 | public ApnsChannel newChannel() {
37 | return new ApnsChannel(this.securitySocketFactory);
38 | }
39 |
40 | public ApnsChannel newChannel(int tryTimes) {
41 | return new ApnsChannel(this.securitySocketFactory, tryTimes);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/cn/teaey/apns4j/network/ApnsGateway.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2015 The Apns4j Project
4 | * *
5 | * * The Netty Project licenses this file to you under the Apache License,
6 | * * version 2.0 (the "License"); you may not use this file except in compliance
7 | * * with the License. You may obtain a copy of the License at:
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * * License for the specific language governing permissions and limitations
15 | * * under the License.
16 | *
17 | */
18 |
19 | package cn.teaey.apns4j.network;
20 |
21 | /**
22 | * @author teaey(xiaofei.wxf)
23 | * @since 1.0.3
24 | */
25 | public enum ApnsGateway {
26 | DEVELOPMENT("gateway.sandbox.push.apple.com", 2195),
27 | PRODUCTION("gateway.push.apple.com", 2195),
28 | RESTFUL_DEVELOPMENT("api.development.push.apple.com", 443),
29 | RESTFUL_PRODUCTION("api.push.apple.com", 443),
30 | RESTFUL_DEVELOPMENT_BAK("api.development.push.apple.com", 2197),
31 | RESTFUL_PRODUCTION_BAK("api.push.apple.com", 2197);
32 | private final String host;
33 | private final int port;
34 |
35 | ApnsGateway(String host, int port) {
36 | this.host = host;
37 | this.port = port;
38 | }
39 |
40 | public String host() {
41 | return this.host;
42 | }
43 |
44 | public int port() {
45 | return this.port;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/cn/teaey/apns4j/keystore/InvalidKeyStoreException.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2015 The Apns4j Project
4 | * *
5 | * * The Netty Project licenses this file to you under the Apache License,
6 | * * version 2.0 (the "License"); you may not use this file except in compliance
7 | * * with the License. You may obtain a copy of the License at:
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * * License for the specific language governing permissions and limitations
15 | * * under the License.
16 | *
17 | */
18 |
19 | package cn.teaey.apns4j.keystore;
20 |
21 | /**
22 | * @author teaey
23 | * @since 1.0.0
24 | */
25 | public class InvalidKeyStoreException extends Exception {
26 | /**
27 | *
47 | *
48 | * @param cause a {@link Exception} object.
49 | */
50 | public InvalidKeyStoreException(Exception cause) {
51 | super(cause);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/cn/teaey/apns4j/keystore/InvalidKeyStoreFormatException.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2015 The Apns4j Project
4 | * *
5 | * * The Netty Project licenses this file to you under the Apache License,
6 | * * version 2.0 (the "License"); you may not use this file except in compliance
7 | * * with the License. You may obtain a copy of the License at:
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * * License for the specific language governing permissions and limitations
15 | * * under the License.
16 | *
17 | */
18 |
19 | package cn.teaey.apns4j.keystore;
20 |
21 | /**
22 | * @author teaey
23 | * @since 1.0.0
24 | */
25 | public class InvalidKeyStoreFormatException extends InvalidKeyStoreException {
26 | /**
27 | *
89 | *
90 | * @param expiry a int.
91 | */
92 | public void setExpiry(int expiry) {
93 | this.expiry = expiry;
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/src/main/java/cn/teaey/apns4j/protocol/ListMap.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2015 The Apns4j Project
4 | * *
5 | * * The Netty Project licenses this file to you under the Apache License,
6 | * * version 2.0 (the "License"); you may not use this file except in compliance
7 | * * with the License. You may obtain a copy of the License at:
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * * License for the specific language governing permissions and limitations
15 | * * under the License.
16 | *
17 | */
18 |
19 | package cn.teaey.apns4j.protocol;
20 |
21 | import java.util.AbstractMap;
22 | import java.util.Iterator;
23 | import java.util.Map;
24 | import java.util.Set;
25 |
26 | /**
27 | * @author teaey
28 | * @since 1.0.0
29 | */
30 | public class ListMap extends AbstractMap implements Map {
31 | Entry[] table;
32 | int size;
33 |
34 | /**
35 | *