This class is a for creating SSLSocket objects. Most applications use the default SSLSocketFactory returned by the static getDefault( ) method. Once this SSLSocketFactory has been obtained, they use one of the inherited createSocket( ) methods to create, and optionally connect and bind, a new SSLSocket. The return value of the createSocket( ) methods is a object, but you can safely cast this object to a SSLSocket if you need to. SSLSocketFactory defines one new version of createSocket( ) in addition to the ones it inherits from its superclass. This version of the method creates an SSLSocket that is layered over an existing Socket object rather than creating a new socket entirely from scratch.

Applications that need to customize the SSL configuration and cannot use the default socket factory may obtain a custom SSLSocketFactory from an SSLContext, which is essentially a factory for socket factories. See SSLContext for details.

Figure 18-17.

public abstract class SSLSocketFactory extends {
// Public Constructors
     public SSLSocketFactory( );  
// Public Class Methods
     public static getDefault( );                 synchronized
                  // Public Instance Methods
     public abstract createSocket( s, String host, 
        int port, boolean autoClose) throws ...

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.