title: How to create custom SSLSocketFactory?
body: <p>I'm trying to create my own implementation of <a href="http://download.oracle.com/javase/6/docs/api/javax/net/ssl/SSLSocketFactory.html" rel="nofollow"><code>javax.net.ssl.SSLSocketFactory</code></a>, in order to catch all HTTP/SSL requests, send by a third-party library, and log them. This is how the factory is called in that library (it's commons-httpclient):</p>
  
  <pre><code>import javax.net.ssl.SSLSocketFactory;
  // ...
  return SSLSocketFactory.getDefault().createSocket(host, port);
  </code></pre>
  
  <p>Current implementation used is <code>com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl</code>. How can I change it to my own custom class?</p>