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


Java SimpleApnsNotification.marshall方法代码示例

本文整理汇总了Java中com.notnoop.apns.SimpleApnsNotification.marshall方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleApnsNotification.marshall方法的具体用法?Java SimpleApnsNotification.marshall怎么用?Java SimpleApnsNotification.marshall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.notnoop.apns.SimpleApnsNotification的用法示例。


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

示例1: deviceTokenPart

import com.notnoop.apns.SimpleApnsNotification; //导入方法依赖的package包/类
@Theory
public void deviceTokenPart(String deviceToken, PayloadBuilder payload) {
    SimpleApnsNotification msg = new SimpleApnsNotification(deviceToken, payload.build());
    byte[] bytes = msg.marshall();

    byte[] dt = decodeHex(deviceToken);
    assertEquals(dt.length, /* found length */ (bytes[1] << 8) + bytes[2]);

    // verify the device token part
    assertArrayEquals(dt, Utilities.copyOfRange(bytes, 3, 3 + dt.length));
}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:12,代码来源:SimpleApnsNotificationTest.java

示例2: payloadPart

import com.notnoop.apns.SimpleApnsNotification; //导入方法依赖的package包/类
@Theory
public void payloadPart(String deviceToken, PayloadBuilder payload) {
    String payloadString = payload.build();
    SimpleApnsNotification msg = new SimpleApnsNotification(deviceToken, payloadString);
    byte[] bytes = msg.marshall();

    byte[] pl = toUTF8Bytes(payloadString);

    // in reverse
    int plBegin = bytes.length - pl.length;

    /// verify the payload part
    assertArrayEquals(pl, Utilities.copyOfRange(bytes, plBegin, bytes.length));
    assertEquals(pl.length, (bytes[plBegin - 2] << 8) + bytes[plBegin - 1]);
}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:16,代码来源:SimpleApnsNotificationTest.java

示例3: allPartsLength

import com.notnoop.apns.SimpleApnsNotification; //导入方法依赖的package包/类
@Theory
public void allPartsLength(String deviceToken, PayloadBuilder payload) {
    String payloadString = payload.build();
    SimpleApnsNotification msg = new SimpleApnsNotification(deviceToken, payloadString);
    byte[] bytes = msg.marshall();

    int expectedLength = 1
        + 2 + decodeHex(deviceToken).length
        + 2 + toUTF8Bytes(payloadString).length;
    assertEquals(expectedLength, bytes.length);
}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:12,代码来源:SimpleApnsNotificationTest.java

示例4: commandIsZero

import com.notnoop.apns.SimpleApnsNotification; //导入方法依赖的package包/类
@Theory
public void commandIsZero(String deviceToken, PayloadBuilder payload) {
    SimpleApnsNotification msg = new SimpleApnsNotification(deviceToken, payload.build());
    byte[] bytes = msg.marshall();
    assertEquals(0, /*command part*/ bytes[0]);
}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:7,代码来源:SimpleApnsNotificationTest.java


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