title: Using Proxy with JavaPNS 2.2
body: <p>I am trying to use JavaPNS 2.2 to push to apple devices trough a proxy. My java application is running on a jBoss behind a firewall and the only way to communicate with the apple serve is trough that proxy. </p>
  
  <pre><code> public ApplePushNotification(File certificate){
  
      super();
      ProxyManager.setProxy("myproxy", "myport");
      this.certificate = certificate;
  
  }
  </code></pre>
  
  <p>I am getting this Exception.</p>
  
  <pre><code>javapns.communication.exceptions.CommunicationException: Communication exception: java.io.IOException: Unable to tunnel through. Proxy returns "HTTP/1.1 407 Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  )"
  </code></pre>
  
  <p>So I read the ProxyManager.java file to find a way for the authorization. I found this:</p>
  
  <pre><code>        /**
           * Configure the authorization for the proxy configured through the setProxy method.
           * 
           * @param username the user name to use
           * @param password the password to use
           */
          public static void setProxyBasicAuthorization(String username, String password) {
                  setProxyAuthorization(encodeProxyAuthorization(username, password));
          }
  </code></pre>
  
  <p>I tried to use that static method like <code>ProxyManager.setProxy("myproxy", "myport");</code> but i am not able to use it.
  I would really appreciate for some help. Thanks</p>
  
  <p>Additional links:</p>
  
  <p><a href="http://code.google.com/p/javapns/source/browse/trunk/src/javapns/communication/ProxyManager.java" rel="nofollow">http://code.google.com/p/javapns/source/browse/trunk/src/javapns/communication/ProxyManager.java</a></p>
  
  <p><a href="http://code.google.com/p/javapns/" rel="nofollow">http://code.google.com/p/javapns/</a></p>