hengsokchamroeun / javapns

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

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

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I am using javapns-jdk1.5-v1.6.2.jar on windows 7, to create a connection to 
apple NS
                PushNotificationManager pushManager = null;
            // Setup up a simple message
            PayLoad aPayload = new PayLoad();
            aPayload.addBadge(BADGE);
            aPayload.addAlert(message);    
            aPayload.addSound("default");

            LOG.info("Payload setup successfull. " + aPayload);

            // Get PushNotification Instance
            pushManager = PushNotificationManager.getInstance(); 

            // Link iPhone's UDID (64-char device token) to a stringName
            pushManager.addDevice("iphone", iPhoneId);
            LOG.info("iPhone UDID taken.");

            LOG.info("Token: " + pushManager.getDevice("iphone").getToken());

            // Get iPhone client
            Device client = pushManager.getDevice("iphone");
            LOG.info("Client setup successfull.");

            // Initialize connection
            pushManager.setProxy("p-host", "p-port"); // 
            pushManager.initializeConnection(HOST, PORT, inputStream, passwd, SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);
            LOG.info("Connection initialized...");

            // Send message
            pushManager.sendNotification(client, aPayload);
            LOG.info("Message sent!");

The code try's to connect (pushManager.initializeConnection(..)), it  throws a 
Connection refused: connect, exception

I have checked my proxy settings and thy are correct, however when i listen on 
the proxy ports the executing code does not connect to the proxy server.

Any ideas?

Thanks

Original issue reported on code.google.com by damendra...@gmail.com on 14 Sep 2010 at 10:38

GoogleCodeExporter commented 8 years ago
What is the complete error? what host/port are you connecting to?

Your snippet shows 'connection refused' which makes me think the host/port is 
incorrect.
'Connection timed out' would be more what I would expect from your conclusion.

I see you looked at issue 18, have you compared your code to the code in that 
issue?
The differences between the 1.5 and 1.6 versions are very minor.

Original comment by idbill.p...@gmail.com on 14 Sep 2010 at 3:57

GoogleCodeExporter commented 8 years ago
Hi,

That was the complete error, hence no stack trace. 

The problem seems to be the proxy server i was trying to tunnel through (can't 
say for certain but it didn't like the way we were trying to socket). anyhow we 
managed to bypass that and connect directly to the apple notification sandbox.

I think this post is now invalid so please delete

Regards

Original comment by damendra...@gmail.com on 16 Sep 2010 at 1:52

GoogleCodeExporter commented 8 years ago

Original comment by idbill.p...@gmail.com on 5 Oct 2010 at 4:54