Package com.notnoop.apns

Examples of com.notnoop.apns.ApnsService


public class ApnsServiceFactoryTest {

    @Test
    public void testApnsServiceFactoryWithFixedCertificates() throws Exception {
        ApnsServiceFactory apnsServiceFactory = createApnsServiceFactoryWithFixedCertificates();
        ApnsService apnsService = apnsServiceFactory.getApnsService();

        doBasicAsserts(apnsService);
    }
View Full Code Here


    }

    @Test(expected = IllegalArgumentException.class)
    public void testApnsServiceFactoryAsPool0() throws Exception {
        ApnsServiceFactory apnsServiceFactory = createApnsServiceFactoryWithFixedCertificatesAsPool(0);
        ApnsService apnsService = apnsServiceFactory.getApnsService();

        doBasicAsserts(apnsService);
    }
View Full Code Here

    }

    @Test
    public void testApnsServiceFactoryAsPool1() throws Exception {
        ApnsServiceFactory apnsServiceFactory = createApnsServiceFactoryWithFixedCertificatesAsPool(1);
        ApnsService apnsService = apnsServiceFactory.getApnsService();

        doBasicAsserts(apnsService);
    }
View Full Code Here

            throw ObjectHelper.wrapRuntimeCamelException(e);
        } catch (GeneralSecurityException e) {
            throw ObjectHelper.wrapRuntimeCamelException(e);
        }

        ApnsService apnsService = builder.build();
        return apnsService;
    }
View Full Code Here

    @Test
    public void simpleFeedback() throws IOException {
        server.getToSend().write(simple);

        ApnsService service =
            APNS.newService().withSSLContext(clientContext)
            .withGatewayDestination(LOCALHOST, server.getEffectiveGatewayPort())
            .withFeedbackDestination(LOCALHOST, server.getEffectiveFeedbackPort())
            .build();

        checkParsedSimple(service.getInactiveDevices());
    }
View Full Code Here

   
    @Test
    public void simpleFeedbackWithoutTimeout() throws IOException {
        server.getToSend().write(simple);
        server.getToWaitBeforeSend().set(2000);
        ApnsService service =
            APNS.newService().withSSLContext(clientContext)
            .withGatewayDestination(LOCALHOST, server.getEffectiveGatewayPort())
            .withFeedbackDestination(LOCALHOST, server.getEffectiveFeedbackPort())
            .withReadTimeout(3000)
            .build();

        checkParsedSimple(service.getInactiveDevices());
    }
View Full Code Here

    @Test()
    public void simpleFeedbackWithTimeout() throws IOException {
        server.getToSend().write(simple);
        server.getToWaitBeforeSend().set(5000);
        ApnsService service =
            APNS.newService().withSSLContext(clientContext)
            .withGatewayDestination(LOCALHOST, server.getEffectiveGatewayPort())
            .withFeedbackDestination(LOCALHOST, server.getEffectiveFeedbackPort())
            .withReadTimeout(1000)
            .build();
        try {
            service.getInactiveDevices();
            fail("RuntimeException expected");
        }
        catch(RuntimeException e) {
            assertEquals("Socket timeout exception expected",
                    SocketTimeoutException.class, e.getCause().getClass() );
View Full Code Here

    @Test
    public void threeFeedback() throws IOException {
        server.getToSend().write(three);

        ApnsService service =
            APNS.newService().withSSLContext(clientContext)
            .withGatewayDestination(LOCALHOST, server.getEffectiveGatewayPort())
            .withFeedbackDestination(LOCALHOST, server.getEffectiveFeedbackPort())
            .build();

        checkParsedThree(service.getInactiveDevices());
    }
View Full Code Here

    @Test
    public void simpleQueuedFeedback() throws IOException {
        server.getToSend().write(simple);

        ApnsService service =
            APNS.newService().withSSLContext(clientContext)
            .withGatewayDestination(LOCALHOST, server.getEffectiveGatewayPort())
            .withFeedbackDestination(LOCALHOST, server.getEffectiveFeedbackPort())
            .asQueued()
            .build();

        checkParsedSimple(service.getInactiveDevices());
    }
View Full Code Here

    @Test
    public void threeQueuedFeedback() throws IOException {
        server.getToSend().write(three);

        ApnsService service =
            APNS.newService().withSSLContext(clientContext)
            .withGatewayDestination(LOCALHOST, server.getEffectiveGatewayPort())
            .withFeedbackDestination(LOCALHOST, server.getEffectiveFeedbackPort())
            .asQueued()
            .build();

        checkParsedThree(service.getInactiveDevices());
    }
View Full Code Here

TOP

Related Classes of com.notnoop.apns.ApnsService

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.