Class EasySSLProtocolSocketFactory

  • All Implemented Interfaces:
    ProtocolSocketFactory, SecureProtocolSocketFactory

    @Deprecated
    public class EasySSLProtocolSocketFactory
    extends Object
    implements SecureProtocolSocketFactory
    Deprecated.
    As of 6.3.0.3 (Package Version 5.7.0), with no replacement.

    EasySSLProtocolSocketFactory can be used to creats SSL Sockets that accept self-signed certificates.

    This socket factory SHOULD NOT be used for productive systems due to security reasons, unless it is a concious decision and you are perfectly aware of security implications of accepting self-signed certificates

    Example of using custom protocol socket factory for a specific host:

         Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
    
         URI uri = new URI("https://localhost/", true);
         // use relative url only
         GetMethod httpget = new GetMethod(uri.getPathQuery());
         HostConfiguration hc = new HostConfiguration();
         hc.setHost(uri.getHost(), uri.getPort(), easyhttps);
         HttpClient client = new HttpClient();
         client.executeMethod(hc, httpget);
         

    Example of using custom protocol socket factory per default instead of the standard one:

         Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
         Protocol.registerProtocol("https", easyhttps);
    
         HttpClient client = new HttpClient();
         GetMethod httpget = new GetMethod("https://localhost/");
         client.executeMethod(httpget);