Package org.conscrypt
Class OpenSSLServerSocketImpl
java.lang.Object
java.net.ServerSocket
javax.net.ssl.SSLServerSocket
org.conscrypt.OpenSSLServerSocketImpl
- All Implemented Interfaces:
Closeable,AutoCloseable
public class OpenSSLServerSocketImpl extends SSLServerSocket
OpenSSL-based implementation of server sockets.
-
Constructor Summary
Constructors Modifier Constructor Description protectedOpenSSLServerSocketImpl(int port, int backlog, InetAddress iAddress, SSLParametersImpl sslParameters)protectedOpenSSLServerSocketImpl(int port, int backlog, SSLParametersImpl sslParameters)protectedOpenSSLServerSocketImpl(int port, SSLParametersImpl sslParameters)protectedOpenSSLServerSocketImpl(SSLParametersImpl sslParameters) -
Method Summary
Modifier and Type Method Description Socketaccept()Waits for an incoming request and blocks until the connection is opened.String[]getEnabledCipherSuites()Returns the names of the enabled cipher suites to be used for new connections.String[]getEnabledProtocols()The names of the protocols' versions that in use on this SSL connection.booleangetEnableSessionCreation()Returns whether new SSL sessions may be established for new connections.booleangetNeedClientAuth()Returns whether server-mode connections will be configured to require client authentication.String[]getSupportedCipherSuites()Returns the names of the supported cipher suites.String[]getSupportedProtocols()The names of the protocols' versions that may be used on this SSL connection.booleangetUseClientMode()Returns whether new connection will act in client mode when handshaking.booleangetWantClientAuth()Returns whether server-mode connections will be configured to request client authentication.booleanisChannelIdEnabled()Checks whether the TLS Channel ID extension is enabled for this server socket.voidsetChannelIdEnabled(boolean enabled)Enables/disables the TLS Channel ID extension for this server socket.voidsetEnabledCipherSuites(String[] suites)This method enables the cipher suites listed by getSupportedCipherSuites().voidsetEnabledProtocols(String[] protocols)This method enables the protocols' versions listed by getSupportedProtocols().voidsetEnableSessionCreation(boolean flag)Sets whether new SSL sessions may be established for new connections.voidsetNeedClientAuth(boolean need)Sets whether server-mode connections will be configured to require client authentication.voidsetUseClientMode(boolean mode)Sets whether new connections should act in client mode when handshaking.voidsetWantClientAuth(boolean want)Sets whether server-mode connections will be configured to request client authentication.Methods inherited from class java.net.ServerSocket
bind, bind, close, getChannel, getImpl$, getInetAddress, getLocalPort, getLocalSocketAddress, getReceiveBufferSize, getReuseAddress, getSoTimeout, implAccept, isBound, isClosed, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSocketFactory, setSoTimeout, toString
-
Constructor Details
-
OpenSSLServerSocketImpl
- Throws:
IOException
-
OpenSSLServerSocketImpl
- Throws:
IOException
-
OpenSSLServerSocketImpl
protected OpenSSLServerSocketImpl(int port, int backlog, SSLParametersImpl sslParameters) throws IOException- Throws:
IOException
-
OpenSSLServerSocketImpl
protected OpenSSLServerSocketImpl(int port, int backlog, InetAddress iAddress, SSLParametersImpl sslParameters) throws IOException- Throws:
IOException
-
-
Method Details
-
getEnableSessionCreation
public boolean getEnableSessionCreation()Description copied from class:SSLServerSocketReturns whether new SSL sessions may be established for new connections.- Specified by:
getEnableSessionCreationin classSSLServerSocket- Returns:
trueif new SSL sessions may be established,falseif existing SSL sessions must be reused.
-
setEnableSessionCreation
public void setEnableSessionCreation(boolean flag)Description copied from class:SSLServerSocketSets whether new SSL sessions may be established for new connections.- Specified by:
setEnableSessionCreationin classSSLServerSocket- Parameters:
flag-trueif new SSL sessions may be established,falseif existing SSL sessions must be reused.
-
getSupportedProtocols
The names of the protocols' versions that may be used on this SSL connection.- Specified by:
getSupportedProtocolsin classSSLServerSocket- Returns:
- an array of protocols names
-
getEnabledProtocols
The names of the protocols' versions that in use on this SSL connection.- Specified by:
getEnabledProtocolsin classSSLServerSocket- Returns:
- an array of protocols names
-
setEnabledProtocols
This method enables the protocols' versions listed by getSupportedProtocols().- Specified by:
setEnabledProtocolsin classSSLServerSocket- Parameters:
protocols- names of all the protocols to enable.- Throws:
IllegalArgumentException- when one or more of the names in the array are not supported, or when the array is null.
-
getSupportedCipherSuites
Description copied from class:SSLServerSocketReturns the names of the supported cipher suites.- Specified by:
getSupportedCipherSuitesin classSSLServerSocket- Returns:
- the names of the supported cipher suites.
-
getEnabledCipherSuites
Description copied from class:SSLServerSocketReturns the names of the enabled cipher suites to be used for new connections.- Specified by:
getEnabledCipherSuitesin classSSLServerSocket- Returns:
- the names of the enabled cipher suites to be used for new connections.
-
setChannelIdEnabled
public void setChannelIdEnabled(boolean enabled)Enables/disables the TLS Channel ID extension for this server socket. -
isChannelIdEnabled
public boolean isChannelIdEnabled()Checks whether the TLS Channel ID extension is enabled for this server socket. -
setEnabledCipherSuites
This method enables the cipher suites listed by getSupportedCipherSuites().- Specified by:
setEnabledCipherSuitesin classSSLServerSocket- Parameters:
suites- the names of all the cipher suites to enable- Throws:
IllegalArgumentException- when one or more of the ciphers in array suites are not supported, or when the array is null.
-
getWantClientAuth
public boolean getWantClientAuth()Description copied from class:SSLServerSocketReturns whether server-mode connections will be configured to request client authentication.- Specified by:
getWantClientAuthin classSSLServerSocket- Returns:
trueis client authentication will be requested,falseif no client authentication is needed.
-
setWantClientAuth
public void setWantClientAuth(boolean want)Description copied from class:SSLServerSocketSets 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
SSLServerSocket.setNeedClientAuth(boolean).- Specified by:
setWantClientAuthin classSSLServerSocket- Parameters:
want-trueif client authentication should be requested,falseif no authentication is needed.
-
getNeedClientAuth
public boolean getNeedClientAuth()Description copied from class:SSLServerSocketReturns whether server-mode connections will be configured to require client authentication.- Specified by:
getNeedClientAuthin classSSLServerSocket- Returns:
trueif client authentication is required,falseif no client authentication is needed.
-
setNeedClientAuth
public void setNeedClientAuth(boolean need)Description copied from class:SSLServerSocketSets 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
SSLServerSocket.setWantClientAuth(boolean).- Specified by:
setNeedClientAuthin classSSLServerSocket- Parameters:
need-trueif client authentication is required,falseif no authentication is needed.
-
setUseClientMode
public void setUseClientMode(boolean mode)Description copied from class:SSLServerSocketSets whether new connections should act in client mode when handshaking.- Specified by:
setUseClientModein classSSLServerSocket- Parameters:
mode-trueif new connections should act in client mode,falseif not.
-
getUseClientMode
public boolean getUseClientMode()Description copied from class:SSLServerSocketReturns whether new connection will act in client mode when handshaking.- Specified by:
getUseClientModein classSSLServerSocket- Returns:
trueif new connections will act in client mode when handshaking,falseif not.
-
accept
Description copied from class:ServerSocketWaits for an incoming request and blocks until the connection is opened. This method returns a socket object representing the just opened connection.- Overrides:
acceptin classServerSocket- Returns:
- the connection representing socket.
- Throws:
IOException- if an error occurs while accepting a new connection.
-