Name

SSLSocketFactory

Synopsis

This class is a javax.net.SocketFactory 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 java.net.Socket 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.

javax.net.ssl.SSLSocketFactory

Figure 18-17. javax.net.ssl.SSLSocketFactory

public abstract class SSLSocketFactory extends javax.net.SocketFactory {
// Public Constructors
     public SSLSocketFactory( );  
// Public Class Methods
     public static javax.net.SocketFactory getDefault( );                 synchronized
                  // Public Instance Methods
     public abstract java.net.Socket createSocket(java.net.Socket 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.