Search in sources :

Example 6 with ApnsService

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

the class ApnsConsumerTest method createCamelContext.

protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ApnsServiceFactory apnsServiceFactory = ApnsUtils.createDefaultTestConfiguration(camelContext);
    ApnsService apnsService = apnsServiceFactory.getApnsService();
    ApnsComponent apnsComponent = new ApnsComponent(apnsService);
    camelContext.addComponent("apns", apnsComponent);
    return camelContext;
}
Also used : CamelContext(org.apache.camel.CamelContext) ApnsServiceFactory(org.apache.camel.component.apns.factory.ApnsServiceFactory) ApnsService(com.notnoop.apns.ApnsService)

Example 7 with ApnsService

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

the class ApnsProducerWithoutTokensHeaderTest method createCamelContext.

protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ApnsServiceFactory apnsServiceFactory = ApnsUtils.createDefaultTestConfiguration(camelContext);
    ApnsService apnsService = apnsServiceFactory.getApnsService();
    ApnsComponent apnsComponent = new ApnsComponent(apnsService);
    camelContext.addComponent("apns", apnsComponent);
    return camelContext;
}
Also used : CamelContext(org.apache.camel.CamelContext) ApnsServiceFactory(org.apache.camel.component.apns.factory.ApnsServiceFactory) ApnsService(com.notnoop.apns.ApnsService)

Example 8 with ApnsService

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

the class QueuedApnsServiceTest method newService.

protected ApnsService newService(ApnsConnection connection, ApnsFeedbackConnection feedback) {
    ApnsService service = new ApnsServiceImpl(connection, null);
    ApnsService queued = new QueuedApnsService(service);
    queued.start();
    return queued;
}
Also used : ApnsService(com.notnoop.apns.ApnsService)

Example 9 with ApnsService

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

the class ApnsConnectionTest method sendOneSimpleWithTimeout.

/**
     * Unlike in the feedback case, push messages won't expose the socket timeout,
     * as the read is done in a separate monitoring thread.
     * 
     * Therefore, normal behavior is expected in this test.
     * 
     * @throws InterruptedException
     */
@Test
public void sendOneSimpleWithTimeout() throws InterruptedException {
    server.getToWaitBeforeSend().set(5000);
    ApnsService service = APNS.newService().withSSLContext(clientContext()).withGatewayDestination(LOCALHOST, gatewayPort).withReadTimeout(1000).build();
    server.stopAt(msg1.length());
    service.push(msg1);
    server.getMessages().acquire();
    assertArrayEquals(msg1.marshall(), server.getReceived().toByteArray());
}
Also used : ApnsService(com.notnoop.apns.ApnsService) Test(org.junit.Test)

Example 10 with ApnsService

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

the class ApnsConnectionTest method sendOneSimpleWithoutTimeout.

@Test
public void sendOneSimpleWithoutTimeout() throws InterruptedException {
    server.getToWaitBeforeSend().set(2000);
    ApnsService service = APNS.newService().withSSLContext(clientContext()).withGatewayDestination(LOCALHOST, gatewayPort).withReadTimeout(5000).build();
    server.stopAt(msg1.length());
    service.push(msg1);
    server.getMessages().acquire();
    assertArrayEquals(msg1.marshall(), server.getReceived().toByteArray());
}
Also used : ApnsService(com.notnoop.apns.ApnsService) Test(org.junit.Test)

Aggregations

ApnsService (com.notnoop.apns.ApnsService)32 Test (org.junit.Test)20 ApnsNotification (com.notnoop.apns.ApnsNotification)5 DeliveryError (com.notnoop.apns.DeliveryError)5 EnhancedApnsNotification (com.notnoop.apns.EnhancedApnsNotification)5 SimpleApnsNotification (com.notnoop.apns.SimpleApnsNotification)5 StartSendingApnsDelegate (com.notnoop.apns.StartSendingApnsDelegate)5 ApnsServerStub (com.notnoop.apns.utils.ApnsServerStub)5 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 CountDownLatch (java.util.concurrent.CountDownLatch)4 CamelContext (org.apache.camel.CamelContext)4 ApnsServiceFactory (org.apache.camel.component.apns.factory.ApnsServiceFactory)4 ApnsDelegate (com.notnoop.apns.ApnsDelegate)2 Repeat (com.notnoop.apns.utils.junit.Repeat)2 ApnsServiceBuilder (com.notnoop.apns.ApnsServiceBuilder)1 ConnectionStub (com.notnoop.apns.internal.QueuedApnsServiceTest.ConnectionStub)1 NetworkIOException (com.notnoop.exceptions.NetworkIOException)1 IOException (java.io.IOException)1 SocketTimeoutException (java.net.SocketTimeoutException)1 GeneralSecurityException (java.security.GeneralSecurityException)1