public ApnsConnectionImpl copy() {
   return new ApnsConnectionImpl(
       factory,
       host,
       port,
       proxy,
       proxyUsername,
       proxyPassword,
       reconnectPolicy.copy(),
       delegate,
       errorDetection,
       threadFactory,
       cacheLength,
       autoAdjustCacheLength,
       readTimeout,
       connectTimeout);
 }
 public void testConnection() throws NetworkIOException {
   ApnsConnectionImpl testConnection = null;
   try {
     testConnection =
         new ApnsConnectionImpl(
             factory,
             host,
             port,
             proxy,
             proxyUsername,
             proxyPassword,
             reconnectPolicy.copy(),
             delegate);
     final ApnsNotification notification =
         new EnhancedApnsNotification(0, 0, new byte[] {0}, new byte[] {0});
     testConnection.sendMessage(notification);
   } finally {
     if (testConnection != null) {
       testConnection.close();
     }
   }
 }