Search in sources :

Example 11 with ApnsService

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

the class ApnsConnectionTest method sendOneSimpleMultiKey.

@Test(timeout = 2000)
public void sendOneSimpleMultiKey() throws InterruptedException {
    ApnsService service = APNS.newService().withSSLContext(clientMultiKeyContext("notnoop-client")).withGatewayDestination(LOCALHOST, gatewayPort).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 12 with ApnsService

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

the class FeedbackTest method threeFeedback.

@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());
}
Also used : ApnsService(com.notnoop.apns.ApnsService) Test(org.junit.Test)

Example 13 with ApnsService

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

the class FeedbackTest method simpleFeedbackWithoutTimeout.

@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());
}
Also used : ApnsService(com.notnoop.apns.ApnsService) Test(org.junit.Test)

Example 14 with ApnsService

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

the class FeedbackTest method simpleQueuedFeedback.

@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());
}
Also used : ApnsService(com.notnoop.apns.ApnsService) Test(org.junit.Test)

Example 15 with ApnsService

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

the class FeedbackTest method threeQueuedFeedback.

@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());
}
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