Package com.notnoop.apns

Examples of com.notnoop.apns.EnhancedApnsNotification


    public void testConnection() throws NetworkIOException {
        ApnsConnectionImpl testConnection = null;
        try {
            testConnection =
                    new ApnsConnectionImpl(factory, host, port, proxy, proxyUsername, proxyPassword, reconnectPolicy.copy(), delegate);
            final ApnsNotification notification = new EnhancedApnsNotification(0, 0, new byte[]{0}, new byte[]{0});
            testConnection.sendMessage(notification);
        } finally {
            if (testConnection != null) {
                testConnection.close();
            }
View Full Code Here


    public AbstractApnsService(ApnsFeedbackConnection feedback) {
        this.feedback = feedback;
    }

    public EnhancedApnsNotification push(String deviceToken, String payload) throws NetworkIOException {
        EnhancedApnsNotification notification =
            new EnhancedApnsNotification(c.incrementAndGet(), EnhancedApnsNotification.MAXIMUM_EXPIRY, deviceToken, payload);
        push(notification);
        return notification;
    }
View Full Code Here

        push(notification);
        return notification;
    }

    public EnhancedApnsNotification push(String deviceToken, String payload, Date expiry) throws NetworkIOException {
        EnhancedApnsNotification notification =
            new EnhancedApnsNotification(c.incrementAndGet(), (int)(expiry.getTime() / 1000), deviceToken, payload);
        push(notification);
        return notification;
    }
View Full Code Here

        push(notification);
        return notification;
    }

    public EnhancedApnsNotification push(byte[] deviceToken, byte[] payload) throws NetworkIOException {
        EnhancedApnsNotification notification =
            new EnhancedApnsNotification(c.incrementAndGet(), EnhancedApnsNotification.MAXIMUM_EXPIRY, deviceToken, payload);
        push(notification);
        return notification;
    }
View Full Code Here

        push(notification);
        return notification;
    }

    public EnhancedApnsNotification push(byte[] deviceToken, byte[] payload, int expiry) throws NetworkIOException {
        EnhancedApnsNotification notification =
            new EnhancedApnsNotification(c.incrementAndGet(), expiry, deviceToken, payload);
        push(notification);
        return notification;
    }
View Full Code Here

    public Collection<EnhancedApnsNotification> push(Collection<String> deviceTokens, String payload) throws NetworkIOException {
        byte[] messageBytes = Utilities.toUTF8Bytes(payload);
        List<EnhancedApnsNotification> notifications = new ArrayList<EnhancedApnsNotification>(deviceTokens.size());
        for (String deviceToken : deviceTokens) {
            byte[] dtBytes = Utilities.decodeHex(deviceToken);
            EnhancedApnsNotification notification =
                new EnhancedApnsNotification(c.incrementAndGet(), EnhancedApnsNotification.MAXIMUM_EXPIRY, dtBytes, messageBytes);
            notifications.add(notification);
            push(notification);
        }
        return notifications;
    }
View Full Code Here

    public Collection<EnhancedApnsNotification> push(Collection<String> deviceTokens, String payload, Date expiry) throws NetworkIOException {
        byte[] messageBytes = Utilities.toUTF8Bytes(payload);
        List<EnhancedApnsNotification> notifications = new ArrayList<EnhancedApnsNotification>(deviceTokens.size());
        for (String deviceToken : deviceTokens) {
            byte[] dtBytes = Utilities.decodeHex(deviceToken);
            EnhancedApnsNotification notification =
                new EnhancedApnsNotification(c.incrementAndGet(), (int)(expiry.getTime() / 1000), dtBytes, messageBytes);
            notifications.add(notification);
            push(notification);
        }
        return notifications;
    }
View Full Code Here

    }

    public Collection<EnhancedApnsNotification> push(Collection<byte[]> deviceTokens, byte[] payload) throws NetworkIOException {
        List<EnhancedApnsNotification> notifications = new ArrayList<EnhancedApnsNotification>(deviceTokens.size());
        for (byte[] deviceToken : deviceTokens) {
            EnhancedApnsNotification notification =
                new EnhancedApnsNotification(c.incrementAndGet(), EnhancedApnsNotification.MAXIMUM_EXPIRY, deviceToken, payload);
            notifications.add(notification);
            push(notification);
        }
        return notifications;
    }
View Full Code Here

    }

    public Collection<EnhancedApnsNotification> push(Collection<byte[]> deviceTokens, byte[] payload, int expiry) throws NetworkIOException {
        List<EnhancedApnsNotification> notifications = new ArrayList<EnhancedApnsNotification>(deviceTokens.size());
        for (byte[] deviceToken : deviceTokens) {
            EnhancedApnsNotification notification =
                new EnhancedApnsNotification(c.incrementAndGet(), expiry, deviceToken, payload);
            notifications.add(notification);
            push(notification);
        }
        return notifications;
    }
View Full Code Here

    @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.messages.acquire();
        assertArrayEquals(apnsNotification.marshall(), server.received.toByteArray());
    }
View Full Code Here

TOP

Related Classes of com.notnoop.apns.EnhancedApnsNotification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.