Android APIs
public abstract class

SSLServerSocket

extends ServerSocket
java.lang.Object
   ↳ java.net.ServerSocket
     ↳ javax.net.ssl.SSLServerSocket

Class Overview

The extension of ServerSocket which provides secure server sockets based on protocols like SSL, TLS, or others.

Summary

Protected Constructors
SSLServerSocket()
Only to be used by subclasses.
SSLServerSocket(int port)
Only to be used by subclasses.
SSLServerSocket(int port, int backlog)
Only to be used by subclasses.
SSLServerSocket(int port, int backlog, InetAddress address)
Only to be used by subclasses.
Public Methods
abstract boolean getEnableSessionCreation()
Returns whether new SSL sessions may be established for new connections.
abstract String[] getEnabledCipherSuites()
Returns the names of the enabled cipher suites to be used for new connections.
abstract String[] getEnabledProtocols()
Returns the names of the enabled protocols to be used for new connections.
abstract boolean getNeedClientAuth()
Returns whether server-mode connections will be configured to require client authentication.
abstract String[] getSupportedCipherSuites()
Returns the names of the supported cipher suites.
abstract String[] getSupportedProtocols()
Returns the names of the supported protocols.
abstract boolean getUseClientMode()
Returns whether new connection will act in client mode when handshaking.
abstract boolean getWantClientAuth()
Returns whether server-mode connections will be configured to request client authentication.
abstract void setEnableSessionCreation(boolean flag)
Sets whether new SSL sessions may be established for new connections.
abstract void setEnabledCipherSuites(String[] suites)
Sets the names of the cipher suites to be enabled for new connections.
abstract void setEnabledProtocols(String[] protocols)
Sets the names of the protocols to be enabled for new connections.
abstract void setNeedClientAuth(boolean need)
Sets whether server-mode connections will be configured to require client authentication.
abstract void setUseClientMode(boolean mode)
Sets whether new connections should act in client mode when handshaking.
abstract void setWantClientAuth(boolean want)
Sets whether server-mode connections will be configured to request client authentication.
[Expand]
Inherited Methods
From class java.net.ServerSocket
From class java.lang.Object
From interface java.io.Closeable
From interface java.lang.AutoCloseable

Protected Constructors

protected SSLServerSocket ()

Added in API level 1

Only to be used by subclasses.

Creates a TCP server socket with the default authentication context.

Throws
IOException if creating the socket fails.

protected SSLServerSocket (int port)

Added in API level 1

Only to be used by subclasses.

Creates a TCP server socket on the specified port with the default authentication context. The connection's default backlog size is 50 connections.

Parameters
port the port to listen on.
Throws
IOException if creating the socket fails.

protected SSLServerSocket (int port, int backlog)

Added in API level 1

Only to be used by subclasses.

Creates a TCP server socket on the specified port using the specified backlog and the default authentication context.

Parameters
port the port to listen on.
backlog the number of pending connections to queue.
Throws
IOException if creating the socket fails.

protected SSLServerSocket (int port, int backlog, InetAddress address)

Added in API level 1

Only to be used by subclasses.

Creates a TCP server socket on the specified port, using the specified backlog, listening on the specified interface, and using the default authentication context.

Parameters
port the port the listen on.
backlog the number of pending connections to queue.
address the address of the interface to accept connections on.
Throws
IOException if creating the socket fails.

Public Methods

public abstract boolean getEnableSessionCreation ()

Added in API level 1

Returns whether new SSL sessions may be established for new connections.

Returns
  • true if new SSL sessions may be established, false if existing SSL sessions must be reused.

public abstract String[] getEnabledCipherSuites ()

Added in API level 1

Returns the names of the enabled cipher suites to be used for new connections.

Returns
  • the names of the enabled cipher suites to be used for new connections.

public abstract String[] getEnabledProtocols ()

Added in API level 1

Returns the names of the enabled protocols to be used for new connections.

Returns
  • the names of the enabled protocols to be used for new connections.

public abstract boolean getNeedClientAuth ()

Added in API level 1

Returns whether server-mode connections will be configured to require client authentication.

Returns
  • true if client authentication is required, false if no client authentication is needed.

public abstract String[] getSupportedCipherSuites ()

Added in API level 1

Returns the names of the supported cipher suites.

Returns
  • the names of the supported cipher suites.

public abstract String[] getSupportedProtocols ()

Added in API level 1

Returns the names of the supported protocols.

Returns
  • the names of the supported protocols.

public abstract boolean getUseClientMode ()

Added in API level 1

Returns whether new connection will act in client mode when handshaking.

Returns
  • true if new connections will act in client mode when handshaking, false if not.

public abstract boolean getWantClientAuth ()

Added in API level 1

Returns whether server-mode connections will be configured to request client authentication.

Returns
  • true is client authentication will be requested, false if no client authentication is needed.

public abstract void setEnableSessionCreation (boolean flag)

Added in API level 1

Sets whether new SSL sessions may be established for new connections.

Parameters
flag true if new SSL sessions may be established, false if existing SSL sessions must be reused.

public abstract void setEnabledCipherSuites (String[] suites)

Added in API level 1

Sets the names of the cipher suites to be enabled for new connections. Only cipher suites returned by getSupportedCipherSuites() are allowed.

Parameters
suites the names of the to be enabled cipher suites.
Throws
IllegalArgumentException if one of the cipher suite names is not supported.

public abstract void setEnabledProtocols (String[] protocols)

Added in API level 1

Sets the names of the protocols to be enabled for new connections. Only protocols returned by getSupportedProtocols() are allowed.

Parameters
protocols the names of the to be enabled protocols.
Throws
IllegalArgumentException if one of the protocols is not supported.

public abstract void setNeedClientAuth (boolean need)

Added in API level 1

Sets whether server-mode connections will be configured to require client authentication. The client authentication is one of the following:

  • authentication required
  • authentication requested
  • no authentication needed
This method overrides the setting of setWantClientAuth(boolean).

Parameters
need true if client authentication is required, false if no authentication is needed.

public abstract void setUseClientMode (boolean mode)

Added in API level 1

Sets whether new connections should act in client mode when handshaking.

Parameters
mode true if new connections should act in client mode, false if not.

public abstract void setWantClientAuth (boolean want)

Added in API level 1

Sets whether server-mode connections will be configured to request client authentication. The client authentication is one of the following:

  • authentication required
  • authentication requested
  • no authentication needed
This method overrides the setting of setNeedClientAuth(boolean).

Parameters
want true if client authentication should be requested, false if no authentication is needed.