public ApnsConnectionImpl copy() { return new ApnsConnectionImpl(factory, host, port, proxy, reconnectPolicy.copy(), delegate, errorDetection, cacheLength, autoAdjustCacheLength); }
private synchronized Socket socket() throws NetworkIOException { if (reconnectPolicy.shouldReconnect()) { Utilities.close(socket); socket = null; reconnectPolicy.reconnected(); logger.debug("Made a new connection to APNS"); } catch (IOException e) {
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(); } } }