Package org.conscrypt
Class SSLSocketImpl
java.lang.Object
java.net.Socket
javax.net.ssl.SSLSocket
org.conscrypt.SSLSocketImpl
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
SSLSocketWrapper
public class SSLSocketImpl extends SSLSocket
SSLSocket implementation.
-
Field Summary
Fields Modifier and Type Field Description protected InputStreaminputprotected OutputStreamoutputprotected SSLRecordProtocolrecordProtocolprotected SSLParametersImplsslParameters -
Constructor Summary
Constructors Modifier Constructor Description protectedSSLSocketImpl(String host, int port, InetAddress localHost, int localPort, SSLParametersImpl sslParameters)ConstructorprotectedSSLSocketImpl(String host, int port, SSLParametersImpl sslParameters)ConstructorprotectedSSLSocketImpl(InetAddress address, int port, InetAddress localAddress, int localPort, SSLParametersImpl sslParameters)ConstructorprotectedSSLSocketImpl(InetAddress host, int port, SSLParametersImpl sslParameters)ConstructorprotectedSSLSocketImpl(SSLParametersImpl sslParameters)Constructor -
Method Summary
Modifier and Type Method Description voidaddHandshakeCompletedListener(HandshakeCompletedListener listener)This method works according to the specification of implemented class.voidclose()This method works according to the specification of implemented class.protected voidcloseTransportLayer()Closes the transport data streams.voidconnect(SocketAddress endpoint)This method works according to the specification of implemented class.voidconnect(SocketAddress endpoint, int timeout)This method works according to the specification of implemented class.String[]getEnabledCipherSuites()This method works according to the specification of implemented class.String[]getEnabledProtocols()This method works according to the specification of implemented class.booleangetEnableSessionCreation()This method works according to the specification of implemented class.InputStreamgetInputStream()This method works according to the specification of implemented class.booleangetNeedClientAuth()This method works according to the specification of implemented class.OutputStreamgetOutputStream()This method works according to the specification of implemented class.SSLSessiongetSession()This method works according to the specification of implemented class.String[]getSupportedCipherSuites()This method works according to the specification of implemented class.String[]getSupportedProtocols()This method works according to the specification of implemented class.booleangetUseClientMode()This method works according to the specification of implemented class.booleangetWantClientAuth()This method works according to the specification of implemented class.protected voidinit()Initialize the SSL socket.protected voidinitTransportLayer()Initialize the transport data streams.protected voidneedAppData()This method is called by SSLSocketInputStream class when client application tries to read application data from the stream, but there is no data in its underlying buffer.voidremoveHandshakeCompletedListener(HandshakeCompletedListener listener)This method works according to the specification of implemented class.voidsendUrgentData(int data)This method is not supported for SSLSocket implementation.voidsetEnabledCipherSuites(String[] suites)This method works according to the specification of implemented class.voidsetEnabledProtocols(String[] protocols)This method works according to the specification of implemented class.voidsetEnableSessionCreation(boolean flag)This method works according to the specification of implemented class.voidsetNeedClientAuth(boolean need)This method works according to the specification of implemented class.voidsetOOBInline(boolean on)This method is not supported for SSLSocket implementation.voidsetUseClientMode(boolean mode)This method works according to the specification of implemented class.voidsetWantClientAuth(boolean want)This method works according to the specification of implemented class.voidstartHandshake()Performs the handshake process over the SSL/TLS connection as described in rfc 2246, TLS v1 specification http://www.ietf.org/rfc/rfc2246.txt.protected voidwriteAppData(byte[] data, int offset, int len)This method is called by SSLSocketOutputStream when a client application tries to send the data over ssl protocol.Methods inherited from class javax.net.ssl.SSLSocket
getSSLParameters, setSSLParameters, shutdownInput, shutdownOutputMethods inherited from class java.net.Socket
bind, getChannel, getFileDescriptor$, getInetAddress, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, setKeepAlive, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setSoLinger, setSoTimeout, setTcpNoDelay, setTrafficClass, toString
-
Field Details
-
recordProtocol
-
sslParameters
-
input
-
output
-
-
Constructor Details
-
SSLSocketImpl
Constructor- Parameters:
sslParameters- : SSLParametersImpl- See Also:
method documentation for more information.
-
SSLSocketImpl
protected SSLSocketImpl(String host, int port, SSLParametersImpl sslParameters) throws IOException, UnknownHostExceptionConstructor- Parameters:
host- : Stringport- : intsslParameters- : SSLParametersImpl- Throws:
IOExceptionUnknownHostException- See Also:
method documentation for more information.
-
SSLSocketImpl
protected SSLSocketImpl(String host, int port, InetAddress localHost, int localPort, SSLParametersImpl sslParameters) throws IOException, UnknownHostExceptionConstructor- Parameters:
host- : Stringport- : intlocalHost- : InetAddresslocalPort- : intsslParameters- : SSLParametersImpl- Throws:
IOExceptionUnknownHostException- See Also:
method documentation for more information.
-
SSLSocketImpl
protected SSLSocketImpl(InetAddress host, int port, SSLParametersImpl sslParameters) throws IOExceptionConstructor- Parameters:
host- : InetAddressport- : intsslParameters- : SSLParametersImpl- Throws:
IOException- See Also:
method documentation for more information.
-
SSLSocketImpl
protected SSLSocketImpl(InetAddress address, int port, InetAddress localAddress, int localPort, SSLParametersImpl sslParameters) throws IOExceptionConstructor- Parameters:
address- : InetAddressport- : intlocalAddress- : InetAddresslocalPort- : intsslParameters- : SSLParametersImpl- Throws:
IOException- See Also:
method documentation for more information.
-
-
Method Details
-
init
Initialize the SSL socket.- Throws:
IOException
-
initTransportLayer
Initialize the transport data streams.- Throws:
IOException
-
closeTransportLayer
Closes the transport data streams.- Throws:
IOException
-
getSupportedCipherSuites
This method works according to the specification of implemented class.- Specified by:
getSupportedCipherSuitesin classSSLSocket- See Also:
method documentation for more information
-
getEnabledCipherSuites
This method works according to the specification of implemented class.- Specified by:
getEnabledCipherSuitesin classSSLSocket- See Also:
method documentation for more information
-
setEnabledCipherSuites
This method works according to the specification of implemented class.- Specified by:
setEnabledCipherSuitesin classSSLSocket- Parameters:
suites- the names of the to be enabled cipher suites.- See Also:
method documentation for more information
-
getSupportedProtocols
This method works according to the specification of implemented class.- Specified by:
getSupportedProtocolsin classSSLSocket- See Also:
method documentation for more information
-
getEnabledProtocols
This method works according to the specification of implemented class.- Specified by:
getEnabledProtocolsin classSSLSocket- See Also:
method documentation for more information
-
setEnabledProtocols
This method works according to the specification of implemented class.- Specified by:
setEnabledProtocolsin classSSLSocket- Parameters:
protocols- the names of the to be enabled protocols.- See Also:
method documentation for more information
-
setUseClientMode
public void setUseClientMode(boolean mode)This method works according to the specification of implemented class.- Specified by:
setUseClientModein classSSLSocket- Parameters:
mode-trueif this connection should act in client mode,falseif not.- See Also:
method documentation for more information
-
getUseClientMode
public boolean getUseClientMode()This method works according to the specification of implemented class.- Specified by:
getUseClientModein classSSLSocket- See Also:
method documentation for more information
-
setNeedClientAuth
public void setNeedClientAuth(boolean need)This method works according to the specification of implemented class.- Specified by:
setNeedClientAuthin classSSLSocket- See Also:
method documentation for more information
-
getNeedClientAuth
public boolean getNeedClientAuth()This method works according to the specification of implemented class.- Specified by:
getNeedClientAuthin classSSLSocket- See Also:
method documentation for more information
-
setWantClientAuth
public void setWantClientAuth(boolean want)This method works according to the specification of implemented class.- Specified by:
setWantClientAuthin classSSLSocket- See Also:
method documentation for more information
-
getWantClientAuth
public boolean getWantClientAuth()This method works according to the specification of implemented class.- Specified by:
getWantClientAuthin classSSLSocket- See Also:
method documentation for more information
-
setEnableSessionCreation
public void setEnableSessionCreation(boolean flag)This method works according to the specification of implemented class.- Specified by:
setEnableSessionCreationin classSSLSocket- Parameters:
flag-trueif new sessions may be created.- See Also:
method documentation for more information
-
getEnableSessionCreation
public boolean getEnableSessionCreation()This method works according to the specification of implemented class.- Specified by:
getEnableSessionCreationin classSSLSocket- Returns:
trueif new sessions may be created, otherwisefalse.- See Also:
method documentation for more information
-
getSession
This method works according to the specification of implemented class.- Specified by:
getSessionin classSSLSocket- Returns:
- the session object.
- See Also:
method documentation for more information
-
addHandshakeCompletedListener
This method works according to the specification of implemented class.- Specified by:
addHandshakeCompletedListenerin classSSLSocket- Parameters:
listener- the listener to register.- See Also:
method documentation for more information
-
removeHandshakeCompletedListener
This method works according to the specification of implemented class.- Specified by:
removeHandshakeCompletedListenerin classSSLSocket- Parameters:
listener- the listener to remove.- See Also:
method documentation for more information
-
startHandshake
Performs the handshake process over the SSL/TLS connection as described in rfc 2246, TLS v1 specification http://www.ietf.org/rfc/rfc2246.txt. If the initial handshake has been already done, this method initiates rehandshake. This method works according to the specification of implemented class.- Specified by:
startHandshakein classSSLSocket- Throws:
IOException- if an error occurs.- See Also:
method documentation for more information
-
getInputStream
This method works according to the specification of implemented class.- Overrides:
getInputStreamin classSocket- Returns:
- the byte-oriented input stream.
- Throws:
IOException- if an error occurs while creating the input stream or the socket is in an invalid state.- See Also:
method documentation for more information
-
getOutputStream
This method works according to the specification of implemented class.- Overrides:
getOutputStreamin classSocket- Returns:
- the byte-oriented output stream.
- Throws:
IOException- if an error occurs while creating the output stream or the socket is in an invalid state.- See Also:
method documentation for more information
-
connect
This method works according to the specification of implemented class.- Overrides:
connectin classSocket- Parameters:
endpoint- the address and port of the remote host to connect to.- Throws:
IOException- if the socket is already connected or an error occurs while connecting.- See Also:
method documentation for more information
-
connect
This method works according to the specification of implemented class.- Overrides:
connectin classSocket- Parameters:
endpoint- the address and port of the remote host to connect to.timeout- the timeout value in milliseconds or0for an infinite timeout.- Throws:
IOException- if the socket is already connected or an error occurs while connecting.- See Also:
method documentation for more information
-
close
This method works according to the specification of implemented class.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classSocket- Throws:
IOException- if an error occurs while closing the socket.- See Also:
method documentation for more information
-
sendUrgentData
This method is not supported for SSLSocket implementation.- Overrides:
sendUrgentDatain classSocket- Parameters:
data- the byte of urgent data to be sent.- Throws:
IOException- if an error occurs while sending urgent data.
-
setOOBInline
This method is not supported for SSLSocket implementation.- Overrides:
setOOBInlinein classSocket- Throws:
SocketException
-
needAppData
This method is called by SSLSocketInputStream class when client application tries to read application data from the stream, but there is no data in its underlying buffer.- Throws:
IOException
-
writeAppData
This method is called by SSLSocketOutputStream when a client application tries to send the data over ssl protocol.- Throws:
IOException
-