Package javax.net.ssl
Class SSLServerSocket
java.lang.Object
java.net.ServerSocket
javax.net.ssl.SSLServerSocket
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
OpenSSLServerSocketImpl,SSLServerSocketImpl
public abstract class SSLServerSocket extends ServerSocket
The extension of
ServerSocket which provides secure server sockets
based on protocols like SSL, TLS, or others.-
Constructor Summary
Constructors Modifier Constructor Description protectedSSLServerSocket()Only to be used by subclasses.protectedSSLServerSocket(int port)Only to be used by subclasses.protectedSSLServerSocket(int port, int backlog)Only to be used by subclasses.protectedSSLServerSocket(int port, int backlog, InetAddress address)Only to be used by subclasses. -
Method Summary
Modifier and Type Method Description 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 booleangetEnableSessionCreation()Returns whether new SSL sessions may be established for new connections.abstract booleangetNeedClientAuth()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 booleangetUseClientMode()Returns whether new connection will act in client mode when handshaking.abstract booleangetWantClientAuth()Returns whether server-mode connections will be configured to request client authentication.abstract voidsetEnabledCipherSuites(String[] suites)Sets the names of the cipher suites to be enabled for new connections.abstract voidsetEnabledProtocols(String[] protocols)Sets the names of the protocols to be enabled for new connections.abstract voidsetEnableSessionCreation(boolean flag)Sets whether new SSL sessions may be established for new connections.abstract voidsetNeedClientAuth(boolean need)Sets whether server-mode connections will be configured to require client authentication.abstract voidsetUseClientMode(boolean mode)Sets whether new connections should act in client mode when handshaking.abstract voidsetWantClientAuth(boolean want)Sets whether server-mode connections will be configured to request client authentication.Methods inherited from class java.net.ServerSocket
accept, bind, bind, close, getChannel, getImpl$, getInetAddress, getLocalPort, getLocalSocketAddress, getReceiveBufferSize, getReuseAddress, getSoTimeout, implAccept, isBound, isClosed, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSocketFactory, setSoTimeout, toString
-
Constructor Details
-
SSLServerSocket
Only to be used by subclasses.Creates a TCP server socket with the default authentication context.
- Throws:
IOException- if creating the socket fails.
-
SSLServerSocket
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.
-
SSLServerSocket
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.
-
SSLServerSocket
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.
-
-
Method Details
-
getEnabledCipherSuites
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.
-
setEnabledCipherSuites
Sets the names of the cipher suites to be enabled for new connections. Only cipher suites returned bygetSupportedCipherSuites()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.
-
getSupportedCipherSuites
Returns the names of the supported cipher suites.- Returns:
- the names of the supported cipher suites.
-
getSupportedProtocols
Returns the names of the supported protocols.- Returns:
- the names of the supported protocols.
-
getEnabledProtocols
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.
-
setEnabledProtocols
Sets the names of the protocols to be enabled for new connections. Only protocols returned bygetSupportedProtocols()are allowed.- Parameters:
protocols- the names of the to be enabled protocols.- Throws:
IllegalArgumentException- if one of the protocols is not supported.
-
setNeedClientAuth
public abstract void setNeedClientAuth(boolean need)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
setWantClientAuth(boolean).- Parameters:
need-trueif client authentication is required,falseif no authentication is needed.
-
getNeedClientAuth
public abstract boolean getNeedClientAuth()Returns whether server-mode connections will be configured to require client authentication.- Returns:
trueif client authentication is required,falseif no client authentication is needed.
-
setWantClientAuth
public abstract void setWantClientAuth(boolean want)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
setNeedClientAuth(boolean).- Parameters:
want-trueif client authentication should be requested,falseif no authentication is needed.
-
getWantClientAuth
public abstract boolean getWantClientAuth()Returns whether server-mode connections will be configured to request client authentication.- Returns:
trueis client authentication will be requested,falseif no client authentication is needed.
-
setUseClientMode
public abstract void setUseClientMode(boolean mode)Sets whether new connections should act in client mode when handshaking.- Parameters:
mode-trueif new connections should act in client mode,falseif not.
-
getUseClientMode
public abstract boolean getUseClientMode()Returns whether new connection will act in client mode when handshaking.- Returns:
trueif new connections will act in client mode when handshaking,falseif not.
-
setEnableSessionCreation
public abstract void setEnableSessionCreation(boolean flag)Sets whether new SSL sessions may be established for new connections.- Parameters:
flag-trueif new SSL sessions may be established,falseif existing SSL sessions must be reused.
-
getEnableSessionCreation
public abstract boolean getEnableSessionCreation()Returns whether new SSL sessions may be established for new connections.- Returns:
trueif new SSL sessions may be established,falseif existing SSL sessions must be reused.
-