sshcheung / javapns

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

Proxy settings are ignored #70

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use example for javapns but behind a proxy

What is the expected output? What do you see instead?
java.net.UnknownHostException: gateway.sandbox.push.apple.com

What version of the product are you using? On what operating system?
2.0-beta5

Additional information:

We are today using push behind a proxy, but when I tested out the 2.0-version 
of javapns I could not get it to work.

I can see in the code that PushNotificationManager is able to set proxy (uses 
System.setProperty). I tried to do this manually but without success, this is 
because the boolean proxySet in ConnectionToAppleServer.java is always set to 
false and therefore newer does a "return tunnelThroughProxy(socketFactory);". 

Hope it will be possible using it behind a proxy, and understand that proxy is 
not supported in this early beta release. 

Regards, 
Thomas

Original issue reported on code.google.com by thoje...@gmail.com on 27 Sep 2011 at 11:07

GoogleCodeExporter commented 8 years ago
Thank you for pointing that out!  I have modified ConnectionToAppleServer to 
check the system property directly for proxy information presence.  I have 
committed a revision 2 with the fix.  

Could you try 2.0 Beta 5 revision 2 and let me know if it works now?  You can 
get revision 2 here:
http://code.google.com/p/javapns/source/browse/branches/javapns2/javapns_2.0_Bet
a_5.jar

Original comment by sype...@gmail.com on 27 Sep 2011 at 12:27

GoogleCodeExporter commented 8 years ago
Thank you very much for quick response! :)

Now the push message gets through the proxy to the iOs-device I`m testing with, 
great!
I notice that "java.net.SocketTimeoutException: Read timed out" is sent to 
standard out, but the exception is not thrown. Guess the timeout is caught some 
where. 

This is the output:
[DEBUG] 2011-09-27 14:49:57,181 
[javapns.communication.ConnectionToAppleServer]:     PeerHost 
gateway.sandbox.push.apple.com
java.net.SocketTimeoutException: Read timed out
[DEBUG] 2011-09-27 14:50:00,181 [javapns.notification.PushNotificationManager]: 
Closing connection

Original comment by thoje...@gmail.com on 27 Sep 2011 at 12:51

GoogleCodeExporter commented 8 years ago
Thanks for confirming that it works now, I'll be closing the issue as Fixed and 
uploading a new revision to the Downloads page.

The SocketTimeoutException comes from the new ResponsePacketReader, whose role 
is to read error-response packets provided by the enhanced notification format. 
 That exception should be silently ignored (the exception is expected), but 
apparently I left a System.out.print(e) in there.  I will remove it in the next 
revision.

Original comment by sype...@gmail.com on 27 Sep 2011 at 1:14