本文整理汇总了Java中com.notnoop.apns.SimpleApnsNotification类的典型用法代码示例。如果您正苦于以下问题:Java SimpleApnsNotification类的具体用法?Java SimpleApnsNotification怎么用?Java SimpleApnsNotification使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleApnsNotification类属于com.notnoop.apns包,在下文中一共展示了SimpleApnsNotification类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例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]);
}
示例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);
}
示例4: lengthConsistency
import com.notnoop.apns.SimpleApnsNotification; //导入依赖的package包/类
@Theory
public void lengthConsistency(String deviceToken, PayloadBuilder payload) {
SimpleApnsNotification msg = new SimpleApnsNotification(deviceToken, payload.build());
assertEquals(msg.marshall().length, msg.length());
}
示例5: 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]);
}