tags:

views:

53

answers:

1

Hi,
I used "feedback.sandbox.push.apple.com" to test my Feedback Service, but just get nothing returned. Is there anyone who get something returned ? My code is below. It really confuses me.

 /******* Here build a sslConnection to get feedback **************/
  try {
      String certPath ="**********_dev_key.p12";
      KeyStore keyStore = KeyStore.getInstance("PKCS12");
      String devPass = "ihandysoft";

      String host ="feedback.sandbox.push.apple.com";
      //host="feedback.push.apple.com";
      int port = 2196;

      keyStore.load(new FileInputStream(certPath), devPass.toCharArray());

      KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
      kmf.init(keyStore, devPass.toCharArray());

      TrustManager[] tms =  new TrustManager[]{new ServerTrustingTrustManager() };
      //tms[0]= new ServerTrustingTrustManager();


      SSLContext sslContext = SSLContext.getInstance("TLS");
      sslContext.init(kmf.getKeyManagers(), tms, null);

      SSLSocketFactory factory = sslContext.getSocketFactory();

      SSLSocket socket = (SSLSocket) factory.createSocket(host, port);
      String [] suites = socket.getSupportedCipherSuites();
      socket.setEnabledCipherSuites(suites);

      socket.startHandshake();

      InputStream is = socket.getInputStream(); 
      byte[] a = new byte[100];

          /*no return information here */
      System.out.println ( is.available() );

      }catch(Exception e) {
          e.printStackTrace();
      }

/**** overriide X509TrustManager : ServerTrustingTrustManager.java****/

public class ServerTrustingTrustManager implements X509TrustManager {

    public void checkClientTrusted( X509Certificate[] chain, String authType ) throws       CertificateException {
            throw new CertificateException( "Client is not trusted." );
    }

    public void checkServerTrusted( X509Certificate[] chain, String authType ) {
            // trust all servers
    }

    public java.security.cert.X509Certificate[] getAcceptedIssuers() {
            return new  java.security.cert.X509Certificate[0];
    }

    public void checkClientTrusted(java.security.cert.X509Certificate[] chain,
            String authType) throws CertificateException {
        // TODO Auto-generated method stub

    }

    public void checkServerTrusted(java.security.cert.X509Certificate[] chain,
            String authType) throws CertificateException {
        // TODO Auto-generated method stub

    }




}
A: 

Hi Henrik,

Did you ever get a resolution to that problem? I am always getting 0 bytes when I read from the input stream too, I saw a post on another site that suggested you need to have two applications on the iphone with feedback enabled for the sandbox server then you need to send messages to both then when you uninstall 1 and send it messages you should be able to get results in the feedback but it still doesnt work for me...

If you did fix it and have any information on it I would really appreciate it.

Regards, Conor

conor roche