Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
GoogleCodeExporter opened this issue Apr 23, 2015 · 3 comments
Closed

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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

  • Changed state: Invalid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant