当前位置: 首页>>代码示例>>Java>>正文


Java ApnsService类代码示例

本文整理汇总了Java中com.notnoop.apns.ApnsService的典型用法代码示例。如果您正苦于以下问题:Java ApnsService类的具体用法?Java ApnsService怎么用?Java ApnsService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ApnsService类属于com.notnoop.apns包,在下文中一共展示了ApnsService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testApns

import com.notnoop.apns.ApnsService; //导入依赖的package包/类
@Test
public void testApns() {
	ApnsService service = APNS.newService()
			.withCert("/Users/dzh/temp/lech/drivercer.p12", "123456")
			.withSandboxDestination().build();
	String payload = APNS.newPayload()
			// .alertTitle("爱拼车22")
			.customField("custom1", "custom1")
			.alertBody("Can't be simpler than this!").build();
	System.out.println(payload);
	String token = "70854405ac6b60b64bdc5338a2d8f4a55a683f63e786a872be42454f6731618d";
	token = "644737130b7d6dde50c1cf1e6fe6bb8be81f728d4b51fc357e3706e431bea213";
	// String token = "83c02996f76268c6b569943cd42feec6"
	service.push(token, payload);

	service.testConnection();
	Map<String, Date> inactiveDevices = service.getInactiveDevices();
	for (String deviceToken : inactiveDevices.keySet()) {
		Date inactiveAsOf = inactiveDevices.get(deviceToken);
		System.out.println(deviceToken);
		System.out.println(inactiveAsOf);
	}
}
 
开发者ID:dzh,项目名称:jframe,代码行数:24,代码来源:TestApns.java

示例2: provideApnsService

import com.notnoop.apns.ApnsService; //导入依赖的package包/类
@Provides
@Singleton
ApnsService provideApnsService(ServletContext context,
    @Flag(FlagName.APNS_CERT_PASSWORD) String password) {
  String ksAlgorithm =
      ((KeyManagerFactory.getDefaultAlgorithm() == null) ? "sunx509" : KeyManagerFactory
          .getDefaultAlgorithm());
  InputStream inputStream;
  if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Production) {
    // The app is running on App Engine...
    // inputStream = context.getResourceAsStream("/WEB-INF/ApnsProduction.jks");
    inputStream = context.getResourceAsStream("/WEB-INF/ApnsDevelopment.jks");
  } else {
    inputStream = context.getResourceAsStream("/WEB-INF/ApnsDevelopment.jks");
  }
  SSLContext sslContext = Utilities.newSSLContext(inputStream, password, "JKS", ksAlgorithm);
  return APNS.newService().withSSLContext(sslContext).withSandboxDestination()
      .withNoErrorDetection().build();
}
 
开发者ID:larrytin,项目名称:realtime-server-appengine,代码行数:20,代码来源:RealtimeServletModule.java

示例3: main

import com.notnoop.apns.ApnsService; //导入依赖的package包/类
public static void main(String[] args) {
    ApnsService service =
            APNS.newService()
                    .withCert(PATH_TO_P12_CERT, CERT_PASSWORD)
                    .withSandboxDestination()
                    .build();

    String payload = APNS.newPayload()
            .alertBody("My first notification\nHello, I'm push notification")
            .sound("default")
            .build();

    service.push(DEVICE_TOKEN, payload);
    System.out.println("The message has been hopefully sent...");
}
 
开发者ID:aggarwalankush,项目名称:push-notification-server,代码行数:16,代码来源:IOSPush.java

示例4: createCamelContext

import com.notnoop.apns.ApnsService; //导入依赖的package包/类
@Override
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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:ApnsConsumerIdleMessageTest.java

示例5: testApnsServiceFactoryWithFixedCertificates

import com.notnoop.apns.ApnsService; //导入依赖的package包/类
@Test
public void testApnsServiceFactoryWithFixedCertificates() throws Exception {
    ApnsServiceFactory apnsServiceFactory = createApnsServiceFactoryWithFixedCertificates();
    ApnsService apnsService = apnsServiceFactory.getApnsService();

    doBasicAsserts(apnsService);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:ApnsServiceFactoryTest.java

示例6: testApnsServiceFactoryAsPool0

import com.notnoop.apns.ApnsService; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testApnsServiceFactoryAsPool0() throws Exception {
    ApnsServiceFactory apnsServiceFactory = createApnsServiceFactoryWithFixedCertificatesAsPool(0);
    ApnsService apnsService = apnsServiceFactory.getApnsService();

    doBasicAsserts(apnsService);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:ApnsServiceFactoryTest.java

示例7: testApnsServiceFactoryAsPool1

import com.notnoop.apns.ApnsService; //导入依赖的package包/类
@Test
public void testApnsServiceFactoryAsPool1() throws Exception {
    ApnsServiceFactory apnsServiceFactory = createApnsServiceFactoryWithFixedCertificatesAsPool(1);
    ApnsService apnsService = apnsServiceFactory.getApnsService();

    doBasicAsserts(apnsService);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:ApnsServiceFactoryTest.java

示例8: createCamelContext

import com.notnoop.apns.ApnsService; //导入依赖的package包/类
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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:ApnsProducerWithoutTokensHeaderTest.java

示例9: sendOneSimple

import com.notnoop.apns.ApnsService; //导入依赖的package包/类
@Test(timeout = 2000)
public void sendOneSimple() throws InterruptedException {
    ApnsService service =
        APNS.newService().withSSLContext(clientContext())
        .withGatewayDestination(TEST_HOST, TEST_GATEWAY_PORT)
        .build();
    server.stopAt(msg1.length());
    service.push(msg1);
    server.messages.acquire();

    assertArrayEquals(msg1.marshall(), server.received.toByteArray());
}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:13,代码来源:ApnsConnectionTest.java

示例10: sendOneQueued

import com.notnoop.apns.ApnsService; //导入依赖的package包/类
@Test(timeout = 2000)
public void sendOneQueued() throws InterruptedException {
    ApnsService service =
        APNS.newService().withSSLContext(clientContext())
        .withGatewayDestination(TEST_HOST, TEST_GATEWAY_PORT)
        .asQueued()
        .build();
    server.stopAt(msg1.length());
    service.push(msg1);
    server.messages.acquire();

    assertArrayEquals(msg1.marshall(), server.received.toByteArray());
}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:14,代码来源:ApnsConnectionTest.java

示例11: simpleFeedback

import com.notnoop.apns.ApnsService; //导入依赖的package包/类
@Test
public void simpleFeedback() throws IOException {
    server.toSend.write(simple);

    ApnsService service =
        APNS.newService().withSSLContext(clientContext)
        .withGatewayDestination(TEST_HOST, TEST_GATEWAY_PORT)
        .withFeedbackDestination(TEST_HOST, TEST_FEEDBACK_PORT)
        .build();

    checkParsedSimple(service.getInactiveDevices());
}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:13,代码来源:FeedbackTest.java

示例12: threeFeedback

import com.notnoop.apns.ApnsService; //导入依赖的package包/类
@Test
public void threeFeedback() throws IOException {
    server.toSend.write(three);

    ApnsService service =
        APNS.newService().withSSLContext(clientContext)
        .withGatewayDestination(TEST_HOST, TEST_GATEWAY_PORT)
        .withFeedbackDestination(TEST_HOST, TEST_FEEDBACK_PORT)
        .build();

    checkParsedThree(service.getInactiveDevices());
}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:13,代码来源:FeedbackTest.java

示例13: simpleQueuedFeedback

import com.notnoop.apns.ApnsService; //导入依赖的package包/类
@Test
public void simpleQueuedFeedback() throws IOException {
    server.toSend.write(simple);

    ApnsService service =
        APNS.newService().withSSLContext(clientContext)
        .withGatewayDestination(TEST_HOST, TEST_GATEWAY_PORT)
        .withFeedbackDestination(TEST_HOST, TEST_FEEDBACK_PORT)
        .asQueued()
        .build();

    checkParsedSimple(service.getInactiveDevices());
}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:14,代码来源:FeedbackTest.java

示例14: threeQueuedFeedback

import com.notnoop.apns.ApnsService; //导入依赖的package包/类
@Test
public void threeQueuedFeedback() throws IOException {
    server.toSend.write(three);

    ApnsService service =
        APNS.newService().withSSLContext(clientContext)
        .withGatewayDestination(TEST_HOST, TEST_GATEWAY_PORT)
        .withFeedbackDestination(TEST_HOST, TEST_FEEDBACK_PORT)
        .asQueued()
        .build();

    checkParsedThree(service.getInactiveDevices());
}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:14,代码来源:FeedbackTest.java

示例15: pushEvantually

import com.notnoop.apns.ApnsService; //导入依赖的package包/类
@Test
public void pushEvantually() {
    ApnsConnection connection = mock(ApnsConnection.class);
    ApnsService service = newService(connection, null);

    service.push(notification);

    verify(connection, times(1)).sendMessage(notification);
}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:10,代码来源:ApnsServiceImplTest.java


注:本文中的com.notnoop.apns.ApnsService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。