title: Could not obtain server certificate chain
body: <p>I have used InstallCert.java file from "<a href="http://code.google.com/p/java-use-examples/source/browse/trunk/src/com/aw/ad/util/InstallCert.java" rel="nofollow">http://code.google.com/p/java-use-examples/source/browse/trunk/src/com/aw/ad/util/InstallCert.java</a>" to generate certificate in java 7(which was installed on CentOS 5.9).</p>
  
  <p>After successfully compiled and run the program, I received UnsupportedOperationException when InstallCert tried to handshake with server host. I found a solution to overcome this issue after doing some searches over the web. Please find the change I made on InstallCert.java file.</p>
  
  <p><strong>Replaced the below line:</strong><br/> 
  <em>SSLSocket socket = (SSLSocket)factory.createSocket(host, port);</em></p>
  
  <p><strong>With this new line:</strong><br/>
  <em>SSLSocket socket = (SSLSocket)factory.getDefault().createSocket(host, port);</em></p>
  
  <p>After the above change was made, SSLSocket handshake has became successful. But when calling the chain() method of SavingTrustManager instance, it returned a <em>null</em> value. Due to this the certificate file was not generated in the working directory.</p>
  
  <p>I appreciate if anyone could help me to overcome this issue and generate the certificate file successfully.</p>
  
  <p><em><strong>Note:</em></strong> I didn't get any issues in Java 6 but the above issues were occured in Java 7.</p>