FileDocCategorySizeDatePackage
SSLSocket.javaAPI DocAndroid 1.5 API10911Wed May 06 22:41:06 BST 2009javax.net.ssl

SSLSocket

public abstract class SSLSocket extends Socket
The extension of {@code Socket} providing secure protocols like SSL (Secure Socket Layer") or TLS (Transport Layer Security).
since
Android 1.0

Fields Summary
Constructors Summary
protected SSLSocket()
Only to be used by subclasses.

Creates a TCP socket.

since
Android 1.0

        super();
    
protected SSLSocket(String host, int port)
Only to be used by subclasses.

Creates a TCP socket connection to the specified host at the specified port.

param
host the host name to connect to.
param
port the port number to connect to.
throws
IOException if creating the socket fails.
throws
UnknownHostException if the specified host is not known.
since
Android 1.0

        super(host, port);
    
protected SSLSocket(InetAddress address, int port)
Only to be used by subclasses.

Creates a TCP socket connection to the specified address at the specified port.

param
address the address to connect to.
param
port the port number to connect to.
throws
IOException if creating the socket fails.
since
Android 1.0

        super(address, port);
    
protected SSLSocket(String host, int port, InetAddress clientAddress, int clientPort)
Only to be used by subclasses.

Creates a TCP socket connection to the specified host at the specified port with the client side bound to the specified address and port.

param
host the host name to connect to.
param
port the port number to connect to.
param
clientAddress the client address to bind to
param
clientPort the client port number to bind to.
throws
IOException if creating the socket fails.
throws
UnknownHostException if the specified host is not known.
since
Android 1.0

        super(host, port, clientAddress, clientPort);
    
protected SSLSocket(InetAddress address, int port, InetAddress clientAddress, int clientPort)
Only to be used by subclasses.

Creates a TCP socket connection to the specified address at the specified port with the client side bound to the specified address and port.

param
address the address to connect to.
param
port the port number to connect to.
param
clientAddress the client address to bind to.
param
clientPort the client port number to bind to.
throws
IOException if creating the socket fails.
since
Android 1.0

        super(address, port, clientAddress, clientPort);
    
Methods Summary
public abstract voidaddHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener listener)
Registers the specified listener to receive notification on completion of a handshake on this connection.

param
listener the listener to register.
throws
IllegalArgumentException if {@code listener} is {@code null}.
since
Android 1.0

public abstract booleangetEnableSessionCreation()
Returns whether new SSL sessions may be created by this socket or if existing sessions must be reused.

return
{@code true} if new sessions may be created, otherwise {@code false}.
since
Android 1.0

public abstract java.lang.String[]getEnabledCipherSuites()
Returns the names of the enabled cipher suites.

return
the names of the enabled cipher suites.
since
Android 1.0

public abstract java.lang.String[]getEnabledProtocols()
Returns the names of the enabled protocols.

return
the names of the enabled protocols.
since
Android 1.0

public abstract booleangetNeedClientAuth()
Returns whether this connection requires client authentication. This is only useful for sockets in server mode.

return
{@code true} if client authentication is required, {@code false} if no client authentication is needed.
since
Android 1.0

public abstract javax.net.ssl.SSLSessiongetSession()
Returns the {@code SSLSession} for this connection. If necessary, a handshake will be initiated, in which case this method will block until the handshake has been established. If the handshake fails, an invalid session object will be returned.

return
the session object.
since
Android 1.0

public abstract java.lang.String[]getSupportedCipherSuites()
Returns the names of the supported cipher suites.

return
the names of the supported cipher suites.
since
Android 1.0

public abstract java.lang.String[]getSupportedProtocols()
Returns the names of the supported protocols.

return
the names of the supported protocols.
since
Android 1.0

public abstract booleangetUseClientMode()
Returns whether this connection will act in client mode when handshaking.

return
{@code true} if this connections will act in client mode when handshaking, {@code false} if not.
since
Android 1.0

public abstract booleangetWantClientAuth()
Returns whether this connections will request client authentication.

return
{@code true} is client authentication will be requested, {@code false} if no client authentication is needed.
since
Android 1.0

public abstract voidremoveHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener listener)
Removes the specified handshake completion listener.

param
listener the listener to remove.
throws
IllegalArgumentException if the specified listener is not registered or {@code null}.
since
Android 1.0

public abstract voidsetEnableSessionCreation(boolean flag)
Sets whether new SSL sessions may be created by this socket or if existing sessions must be reused.

param
flag {@code true} if new sessions may be created, otherwise {@code false}.
since
Android 1.0

public abstract voidsetEnabledCipherSuites(java.lang.String[] suites)
Sets the names of the cipher suites to be enabled. Only cipher suites returned by {@link #getSupportedCipherSuites()} are allowed.

param
suites the names of the to be enabled cipher suites.
throws
IllegalArgumentException if one of the cipher suite names is not supported.
since
Android 1.0

public abstract voidsetEnabledProtocols(java.lang.String[] protocols)
Sets the names of the protocols to be enabled. Only protocols returned by {@link #getSupportedProtocols()} are allowed.

param
protocols the names of the to be enabled protocols.
throws
IllegalArgumentException if one of the protocols is not supported.
since
Android 1.0

public abstract voidsetNeedClientAuth(boolean need)
Sets whether this connection should require client authentication. This is only useful for sockets in server mode. The client authentication is one of the following:
  • authentication required
  • authentication requested
  • no authentication needed
This method overrides the setting of {@link #setWantClientAuth(boolean)}.

param
need {@code true} if client authentication is required, {@code false} if no authentication is needed.
since
Android 1.0

public abstract voidsetUseClientMode(boolean mode)
Sets whether this connection should act in client mode when handshaking.

param
mode {@code true} if this connection should act in client mode, {@code false} if not.
since
Android 1.0

public abstract voidsetWantClientAuth(boolean want)
Sets whether this connections should request client authentication. This is only useful for sockets in server mode. The client authentication is one of:
  • authentication required
  • authentication requested
  • no authentication needed
This method overrides the setting of {@link #setNeedClientAuth(boolean)}.

param
want {@code true} if client authentication should be requested, {@code false} if not authentication is needed.
since
Android 1.0

public abstract voidstartHandshake()
Starts a new SSL handshake on this connection.

throws
IOException if an error occurs.
since
Android 1.0