2012-11-26 64 views
2

我想通過代理使用JavaPNS 2.2推送到蘋果設備。我的Java應用程序在防火牆後面的jBoss上運行,與蘋果服務器通信的唯一方法是通過該代理。使用代理與JavaPNS 2.2

public ApplePushNotification(File certificate){ 

    super(); 
    ProxyManager.setProxy("myproxy", "myport"); 
    this.certificate = certificate; 

} 

我得到這個異常。

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. )" 

所以我讀了ProxyManager.java文件來找到授權的方法。我發現這一點:

 /** 
     * 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)); 
     } 

我試圖用像ProxyManager.setProxy("myproxy", "myport");靜態方法,但我不能夠使用它。 我真的很感謝一些幫助。由於

其他鏈接:

http://code.google.com/p/javapns/source/browse/trunk/src/javapns/communication/ProxyManager.java

http://code.google.com/p/javapns/

+0

我發現setProxyBasicAuthorization(字符串username,字符串密碼)是包括在javapns 2.3_Beta的靜態方法。我會嘗試測試版。 – user1841944

回答