title: Apple push APNS connection
body: <p>I am trying to connect to Apple's push notification server to send down notifications but I am having some issues connecting. After I attempt the handshake, it shows that says that I am not connected. I am not getting any exceptions? It isn't a issue with my certificate because I tried using 3rd party libraries with the certificate and I was able to push with no problem. </p>
  
  <pre><code>int port = 2195;
  String hostname = "gateway.sandbox.push.apple.com";
  char[] passwKey = "password".toCharArray();
  
  KeyStore ts = KeyStore.getInstance("PKCS12");
  ts.load(new FileInputStream("/path/to/file/Cert.p12"), passwKey);
  KeyManagerFactory tmf = KeyManagerFactory.getInstance("SunX509");
  tmf.init(ts, passwKey);
  
  SSLContext sslContext = SSLContext.getInstance("TLS");
  sslContext.init(tmf.getKeyManagers(), null, null);
  SSLSocketFactory factory = sslContext.getSocketFactory();
  
  SSLSocket socket = (SSLSocket) factory.createSocket(hostname,port); 
  String[] suites = socket.getSupportedCipherSuites();
  socket.setEnabledCipherSuites(suites);
  //start handshake
  socket.startHandshake();
  
  //THIS ALWAYS RETURNS FALSE
  boolean connected = socket.isConnected();
  </code></pre>