Package com.notnoop.apns

Examples of com.notnoop.apns.ApnsService.push()


            }
        })
                .build();
        server.stopAt(eMsg1.length() * 5 + eMsg2.length() + eMsg3.length() * 14);
        for (int i = 0; i < 5; ++i) {
            service.push(eMsg1);
        }


        service.push(eMsg2);

View Full Code Here


        for (int i = 0; i < 5; ++i) {
            service.push(eMsg1);
        }


        service.push(eMsg2);

        for (int i = 0; i < 101; ++i) {
            service.push(eMsg3);
        }
View Full Code Here


        service.push(eMsg2);

        for (int i = 0; i < 101; ++i) {
            service.push(eMsg3);
        }

        server.sendError(8, eMsg2.getIdentifier());

        server.getWaitForError().release();
View Full Code Here

    @Test
    public void pushEventually() {
        ApnsConnection connection = mock(ApnsConnection.class);
        ApnsService service = newService(connection, null);

        service.push(notification);

        verify(connection, times(1)).sendMessage(notification);
    }

    @Test
View Full Code Here

    @Test
    public void pushEventuallySample() {
        ApnsConnection connection = mock(ApnsConnection.class);
        ApnsService service = newService(connection, null);

        service.push("2342", "{}");

        verify(connection, times(1)).sendMessage(notification);
    }

    protected ApnsService newService(ApnsConnection connection, ApnsFeedbackConnection feedback) {
View Full Code Here

    @Test
    public void pushEventually() {
        ConnectionStub connection = spy(new ConnectionStub(0, 1));
        ApnsService service = newService(connection, null);

        service.push(notification);
        connection.semaphore.acquireUninterruptibly();

        verify(connection, times(1)).sendMessage(notification);
    }
View Full Code Here

                logger.log(Level.FINE, "Sending transformed APNs payload: " + apnsMessage);
                // send:
                service.start();

                Date expireDate = createFutureDateBasedOnTTL(pushMessage.getTimeToLive());
                service.push(tokens, apnsMessage, expireDate);
                logger.log(Level.INFO, "Message to APNs has been submitted");

                // after sending, let's ask for the inactive tokens:
                final Set<String> inactiveTokens = service.getInactiveDevices().keySet();
                // transform the tokens to be all lower-case:
View Full Code Here

    }

    if(timeout<=0){
      try
        service.push(deviceid, payload)
      } catch (NetworkIOException e) {
        Logger.error("Error sending push notification");
        Logger.error(ExceptionUtils.getStackTrace(e));
        throw new PushNotInitializedException("Error processing certificate, maybe it's revoked");
        //icallbackPush.onError(e.getMessage());
View Full Code Here

        //icallbackPush.onError(e.getMessage());
      }
    } else {
      try {
        Date expiry = new Date(Long.MAX_VALUE);
        service.push(deviceid,payload,expiry);
      } catch (NetworkIOException e) {
        Logger.error("Error sending enhanced push notification");
        Logger.error(ExceptionUtils.getStackTrace(e));
        throw new PushNotInitializedException("Error processing certificate, maybe it's revoked");
        //icallbackPush.onError(e.getMessage());
View Full Code Here

                logger.log(Level.FINE, "Sending transformed APNs payload: " + apnsMessage);
                // send:
                service.start();

                Date expireDate = createFutureDateBasedOnTTL(pushMessage.getTimeToLive());
                service.push(tokens, apnsMessage, expireDate);
                logger.log(Level.INFO, "Message to APNs has been submitted");

                // after sending, let's ask for the inactive tokens:
                final Set<String> inactiveTokens = service.getInactiveDevices().keySet();
                // transform the tokens to be all lower-case:
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.