Narendrabrsoft / javapns

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

javapns.communication.exceptions.CommunicationException: Communication exception: java.net.ConnectException: Connection timed out: connect #172

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Simple basic Java Program on Windows 7
2.
3.

What is the expected output? What do you see instead?
Notification delivered to the device. But I get 

javapns.communication.exceptions.CommunicationException: Communication 
exception: java.net.ConnectException: Connection timed out: connect
    at javapns.communication.ConnectionToAppleServer.getSSLSocket(ConnectionToAppleServer.java:158)
    at javapns.notification.PushNotificationManager.initializeConnection(PushNotificationManager.java:106)
    at javapns.Push.sendPayload(Push.java:171)
    at javapns.Push.payload(Push.java:149)
    at PushTest.main(PushTest.java:35)
Caused by: java.net.ConnectException: Connection timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(Unknown Source)
    at javapns.communication.ConnectionToAppleServer.getSSLSocket(ConnectionToAppleServer.java:155)
    ... 4 more

What version of the product are you using? On what operating system?
I am using JavaPNS 2.3 Beta on Windows Operating system.

Please provide any additional information below.
The same application worked fine on MAC but have problem when ran on Windows 7. 
This is what I have

public class PushTest {

    Logger log = Logger.getLogger("PushTest.class");

    /**
    * @param args
    */
    public static void main(String[] args) {
        try {
            String json = "{\"aps\":{\"sound\":\"default\",\"alert\":\"Hello World\",\"badge\":1}}";
            Payload pl = new Payload(json) {
            };

            System.out.println(" Pay load is " + pl.getPayload());

            InputStream keystore = new FileInputStream(
                    "C:/docs/pushcertificate.p12");
            String receivingdeviceId = "deviceId";

            PushedNotifications notifications = Push.payload(pl, keystore,
                    "pasword", false, receivingdeviceId);

            // PushedNotifications notifications = Push.payloads(keystore,
            // "password", false, receivingdeviceId );

            System.out.println("Hello " + notifications.size());

        } catch (Exception e) {
            e.printStackTrace();
        } 
    }
}

Original issue reported on code.google.com by revanthv4@gmail.com on 12 Mar 2013 at 4:17

GoogleCodeExporter commented 8 years ago
Are you still having this issue?  Was it a Windows security or firewall-related 
issue?

Original comment by sype...@gmail.com on 8 May 2013 at 9:23

GoogleCodeExporter commented 8 years ago
Looks like it is the firewall related issue. Because, when I moved the code
to the server, it was working fine. Thanks for your response.

Original comment by revanthv4@gmail.com on 9 May 2013 at 2:08

GoogleCodeExporter commented 8 years ago
Thank you for the feedback!  Closing.

Original comment by sype...@gmail.com on 9 May 2013 at 2:25