Search in sources :

Example 11 with EnhancedApnsNotification

use of com.notnoop.apns.EnhancedApnsNotification in project java-apns by notnoop.

the class AbstractApnsService method push.

public EnhancedApnsNotification push(byte[] deviceToken, byte[] payload, int expiry) throws NetworkIOException {
    EnhancedApnsNotification notification = new EnhancedApnsNotification(c.incrementAndGet(), expiry, deviceToken, payload);
    push(notification);
    return notification;
}
Also used : EnhancedApnsNotification(com.notnoop.apns.EnhancedApnsNotification)

Example 12 with EnhancedApnsNotification

use of com.notnoop.apns.EnhancedApnsNotification in project camel by apache.

the class ApnsProducerWithoutTokensHeaderTest method testProducerWithoutTokenHeader.

@Test(timeout = 5000)
public void testProducerWithoutTokenHeader() throws Exception {
    String message = "Hello World";
    String messagePayload = APNS.newPayload().alertBody(message).build();
    EnhancedApnsNotification apnsNotification = new EnhancedApnsNotification(1, EnhancedApnsNotification.MAXIMUM_EXPIRY, FAKE_TOKEN, messagePayload);
    server.stopAt(apnsNotification.length());
    template.sendBody("direct:test", message);
    server.getMessages().acquire();
    assertArrayEquals(apnsNotification.marshall(), server.getReceived().toByteArray());
}
Also used : EnhancedApnsNotification(com.notnoop.apns.EnhancedApnsNotification) Test(org.junit.Test)

Aggregations

EnhancedApnsNotification (com.notnoop.apns.EnhancedApnsNotification)12 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)3 ApnsNotification (com.notnoop.apns.ApnsNotification)1