idanappxoee / javapns

Automatically exported from code.google.com/p/javapns
0 stars 0 forks source link

java.net.ConnectException: Connection timed out: connect #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

What is the expected output? What do you see instead?
I am waiting to be connected to APNS but after 8-9 seconds I get
java.net.ConnectException: Connection timed out: connect execption.

What version of the product are you using? On what operating system?
javapns-jdk16-161.jar on Windows XP...I am running the provider or client
from eclipse

Please provide any additional information below.

import javapns.back.PushNotificationManager; 
 import javapns.back.SSLConnectionHelper; 
 import javapns.data.Device; 
import javapns.data.PayLoad; 
 public class Test { 
     // APNs Server Host & port 
     private static final String HOST = "gateway.sandbox.push.apple.com"; 
     private static final int PORT = 2195; 
     // Badge 
     private static final int BADGE = 66; 
     // iPhone's UDID (64-char device token) 
     private static String iPhoneId =
"f4201f5d8278fe39545349d0868a24a3b60ed732"; 
     private static String certificate =
"D:/certificate/NewAPNSGVDS_Certificate.p12"; 

    private static String passwd = "satyam123"; 
 public static void main( String[] args ) throws Exception
{System.out.println( "Setting up Push notification" ); 
        try { 

             // Setup up a simple message 
             PayLoad aPayload = new PayLoad(); 
             aPayload.addBadge( BADGE ); 
             aPayload.addAlert("Hello! you have a new OVD Email");
             System.out.println( "Payload setup successfull." ); 
             System.out.println ( aPayload ); 
             // Get PushNotification Instance 
             PushNotificationManager pushManager =
PushNotificationManager.getInstance(); 
             // Link iPhone's UDID (64-char device token) to a stringName 
             pushManager.addDevice("iPhone", iPhoneId); 
             System.out.println( "iPhone UDID taken." ); 
             System.out.println( "Token: " + pushManager.getDevice(
"iPhone" ).getToken() ); 
             // Get iPhone client 
             Device client = pushManager.getDevice( "iPhone" ); 
             System.out.println( "Client setup successfull." ); 
             // Initialize connection
             pushManager.initializeConnection( HOST, PORT, certificate,
passwd, SSLConnectionHelper.KEYSTORE_TYPE_PKCS12); 
             System.out.println( "Connection initialized..." ); 
             // Send message 
             pushManager.sendNotification( client, aPayload ); 
             System.out.println( "Message sent!" ); 
             System.out.println( "# of attempts: " +
pushManager.getRetryAttempts() ); 
             pushManager.stopConnection(); 
             System.out.println( "done" ); 
         } catch (Exception e) { 
             e.printStackTrace(); 
         } 
     } 
 }

Original issue reported on code.google.com by sumitvya...@gmail.com on 11 May 2010 at 6:21

GoogleCodeExporter commented 9 years ago
Connection timed out...

What happens when you type this in your shell:
telnet gateway.sandbox.push.apple.com 2195

?

Original comment by idbill.p...@gmail.com on 11 May 2010 at 7:41

GoogleCodeExporter commented 9 years ago
thanx for your prompt reply sir. But, I got it fixed the issue was with the 
proxy 
settings of my workplace that couldn't let the host access.

Thanks a lot.....Cheers for Java PNS.

Original comment by sumitvya...@gmail.com on 11 May 2010 at 11:25

GoogleCodeExporter commented 9 years ago

Original comment by idbill.p...@gmail.com on 12 May 2010 at 12:15

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
xhodte do pice !

Original comment by svin...@gmail.com on 4 Dec 2013 at 4:36

GoogleCodeExporter commented 9 years ago
Sir~ did you fix this problem?

Original comment by sodaesa@gmail.com on 12 Sep 2014 at 10:06

GoogleCodeExporter commented 9 years ago
This is an old thread. If I remember clearly, there were firewall issues.

Original comment by sumitvya...@gmail.com on 12 Sep 2014 at 12:14