/** * Returns the length of the message in bytes as it is encoded on the wire. * * Apple require the message to be of length 255 bytes or less. * * @return length of encoded message in bytes */ public int length() { int length = 1 + 2 + deviceToken.length + 2 + payload.length; assert marshall().length == length; return length; }
public void testConnection() throws NetworkIOException { ApnsConnectionImpl testConnection = null; try { testConnection = new ApnsConnectionImpl(factory, host, port, reconnectPolicy.copy(), ApnsDelegate.EMPTY); testConnection.sendMessage(new SimpleApnsNotification(new byte[]{0}, new byte[]{0})); } finally { if (testConnection != null) { testConnection.close(); } } }