public final class SSLSocketImpl
extends javax.net.ssl.SSLSocket
This API offers a non-traditional option for establishing SSL connections. You may first establish the connection directly, then pass that connection to the SSL socket constructor with a flag saying which role should be taken in the handshake protocol. (The two ends of the connection must not choose the same role!) This allows setup of SSL proxying or tunneling, and also allows the kind of "role reversal" that is required for most FTP data transfers.
SSLSocket,
SSLServerSocket| Modifier and Type | Method and Description |
|---|---|
void |
addHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener listener)
Registers an event listener to receive notifications that an
SSL handshake has completed on this connection.
|
void |
bind(java.net.SocketAddress arg0) |
void |
close()
Closes the SSL connection.
|
void |
connect(java.net.SocketAddress arg0) |
void |
connect(java.net.SocketAddress endpoint,
int timeout)
Connects this socket to the server with a specified timeout
value.
|
java.nio.channels.SocketChannel |
getChannel() |
java.lang.String[] |
getEnabledCipherSuites()
Returns the names of the SSL cipher suites which are currently enabled
for use on this connection.
|
java.lang.String[] |
getEnabledProtocols() |
boolean |
getEnableSessionCreation()
Returns true if new connections may cause creation of new SSL
sessions.
|
javax.net.ssl.SSLSession |
getHandshakeSession() |
java.net.InetAddress |
getInetAddress() |
java.io.InputStream |
getInputStream()
Gets an input stream to read from the peer on the other side.
|
boolean |
getKeepAlive() |
java.net.InetAddress |
getLocalAddress() |
int |
getLocalPort() |
java.net.SocketAddress |
getLocalSocketAddress() |
boolean |
getNeedClientAuth() |
boolean |
getOOBInline() |
java.io.OutputStream |
getOutputStream()
Gets an output stream to write to the peer on the other side.
|
int |
getPort() |
int |
getReceiveBufferSize() |
java.net.SocketAddress |
getRemoteSocketAddress() |
boolean |
getReuseAddress() |
int |
getSendBufferSize() |
javax.net.ssl.SSLSession |
getSession()
Returns the the SSL Session in use by this connection.
|
int |
getSoLinger() |
int |
getSoTimeout() |
javax.net.ssl.SSLParameters |
getSSLParameters()
Returns the SSLParameters in effect for this SSLSocket.
|
java.lang.String[] |
getSupportedCipherSuites()
Returns the names of the cipher suites which could be enabled for use
on an SSL connection.
|
java.lang.String[] |
getSupportedProtocols()
Returns the protocols that are supported by this implementation.
|
boolean |
getTcpNoDelay() |
int |
getTrafficClass() |
boolean |
getUseClientMode() |
boolean |
getWantClientAuth() |
boolean |
isBound() |
boolean |
isClosed()
Return whether the socket has been explicitly closed by the application.
|
boolean |
isConnected() |
boolean |
isInputShutdown() |
boolean |
isOutputShutdown() |
void |
removeHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener listener)
Removes a previously registered handshake completion listener.
|
void |
sendUrgentData(int arg0) |
void |
setEnabledCipherSuites(java.lang.String[] suites)
Controls which particular cipher suites are enabled for use on
this connection.
|
void |
setEnabledProtocols(java.lang.String[] protocols)
Controls which protocols are enabled for use on
this connection.
|
void |
setEnableSessionCreation(boolean flag)
Controls whether new connections may cause creation of new SSL
sessions.
|
void |
setKeepAlive(boolean arg0) |
void |
setNeedClientAuth(boolean flag)
Sets the flag controlling whether a server mode socket
*REQUIRES* SSL client authentication.
|
void |
setOOBInline(boolean arg0) |
void |
setPerformancePreferences(int arg0,
int arg1,
int arg2) |
void |
setReceiveBufferSize(int arg0) |
void |
setReuseAddress(boolean arg0) |
void |
setSendBufferSize(int arg0) |
void |
setSoLinger(boolean arg0,
int arg1) |
void |
setSoTimeout(int timeout)
Assigns the socket timeout.
|
void |
setSSLParameters(javax.net.ssl.SSLParameters params)
Applies SSLParameters to this socket.
|
void |
setTcpNoDelay(boolean arg0) |
void |
setTrafficClass(int arg0) |
void |
setUseClientMode(boolean flag)
Sets the flag controlling whether the socket is in SSL
client or server mode.
|
void |
setWantClientAuth(boolean flag)
Sets the flag controlling whether a server mode socket
*REQUESTS* SSL client authentication.
|
void |
shutdownInput() |
void |
shutdownOutput() |
void |
startHandshake()
Starts an SSL handshake on this connection.
|
java.lang.String |
toString()
Returns a printable representation of this end of the connection.
|
public void connect(java.net.SocketAddress endpoint,
int timeout)
throws java.io.IOException
connect in class java.net.Socketendpoint - the SocketAddresstimeout - the timeout value to be used, 0 is no timeoutjava.io.IOException - if an error occurs during the connectionjava.net.SocketTimeoutException - if timeout expires before connectingpublic void startHandshake()
throws java.io.IOException
startHandshake in class javax.net.ssl.SSLSocketjava.io.IOExceptionpublic boolean isClosed()
isClosed in class java.net.Socketpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic java.io.InputStream getInputStream()
throws java.io.IOException
java.io.IOExceptionpublic java.io.OutputStream getOutputStream()
throws java.io.IOException
java.io.IOExceptionpublic javax.net.ssl.SSLSession getSession()
getSession in class javax.net.ssl.SSLSocketpublic javax.net.ssl.SSLSession getHandshakeSession()
getHandshakeSession in class javax.net.ssl.SSLSocketpublic void setEnableSessionCreation(boolean flag)
setEnableSessionCreation in class javax.net.ssl.SSLSocketpublic boolean getEnableSessionCreation()
getEnableSessionCreation in class javax.net.ssl.SSLSocketpublic void setNeedClientAuth(boolean flag)
setNeedClientAuth in class javax.net.ssl.SSLSocketpublic boolean getNeedClientAuth()
getNeedClientAuth in class javax.net.ssl.SSLSocketpublic void setWantClientAuth(boolean flag)
setWantClientAuth in class javax.net.ssl.SSLSocketpublic boolean getWantClientAuth()
getWantClientAuth in class javax.net.ssl.SSLSocketpublic void setUseClientMode(boolean flag)
setUseClientMode in class javax.net.ssl.SSLSocketpublic boolean getUseClientMode()
getUseClientMode in class javax.net.ssl.SSLSocketpublic java.lang.String[] getSupportedCipherSuites()
getSupportedCipherSuites in class javax.net.ssl.SSLSocketpublic void setEnabledCipherSuites(java.lang.String[] suites)
setEnabledCipherSuites in class javax.net.ssl.SSLSocketsuites - Names of all the cipher suites to enable.public java.lang.String[] getEnabledCipherSuites()
getEnabledCipherSuites in class javax.net.ssl.SSLSocketpublic java.lang.String[] getSupportedProtocols()
getSupportedProtocols in class javax.net.ssl.SSLSocketpublic void setEnabledProtocols(java.lang.String[] protocols)
setEnabledProtocols in class javax.net.ssl.SSLSocketprotocols - protocols to enable.java.lang.IllegalArgumentException - when one of the protocols
named by the parameter is not supported.public java.lang.String[] getEnabledProtocols()
getEnabledProtocols in class javax.net.ssl.SSLSocketpublic void setSoTimeout(int timeout)
throws java.net.SocketException
java.net.SocketExceptionSocket.setSoTimeout(int)public void addHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener listener)
addHandshakeCompletedListener in class javax.net.ssl.SSLSocketpublic void removeHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener listener)
removeHandshakeCompletedListener in class javax.net.ssl.SSLSocketpublic javax.net.ssl.SSLParameters getSSLParameters()
getSSLParameters in class javax.net.ssl.SSLSocketpublic void setSSLParameters(javax.net.ssl.SSLParameters params)
setSSLParameters in class javax.net.ssl.SSLSocketpublic java.lang.String toString()
public final java.nio.channels.SocketChannel getChannel()
getChannel in class java.net.Socketpublic void bind(java.net.SocketAddress arg0)
throws java.io.IOException
bind in class java.net.Socketjava.io.IOExceptionpublic java.net.SocketAddress getLocalSocketAddress()
getLocalSocketAddress in class java.net.Socketpublic java.net.SocketAddress getRemoteSocketAddress()
getRemoteSocketAddress in class java.net.Socketpublic final void connect(java.net.SocketAddress arg0)
throws java.io.IOException
connect in class java.net.Socketjava.io.IOExceptionpublic final boolean isConnected()
isConnected in class java.net.Socketpublic final boolean isBound()
isBound in class java.net.Socketpublic final void shutdownInput()
throws java.io.IOException
shutdownInput in class java.net.Socketjava.io.IOExceptionpublic final void shutdownOutput()
throws java.io.IOException
shutdownOutput in class java.net.Socketjava.io.IOExceptionpublic final boolean isInputShutdown()
isInputShutdown in class java.net.Socketpublic final boolean isOutputShutdown()
isOutputShutdown in class java.net.Socketpublic final java.net.InetAddress getInetAddress()
getInetAddress in class java.net.Socketpublic final java.net.InetAddress getLocalAddress()
getLocalAddress in class java.net.Socketpublic final int getPort()
getPort in class java.net.Socketpublic final int getLocalPort()
getLocalPort in class java.net.Socketpublic final void setTcpNoDelay(boolean arg0)
throws java.net.SocketException
setTcpNoDelay in class java.net.Socketjava.net.SocketExceptionpublic final boolean getTcpNoDelay()
throws java.net.SocketException
getTcpNoDelay in class java.net.Socketjava.net.SocketExceptionpublic final void setSoLinger(boolean arg0,
int arg1)
throws java.net.SocketException
setSoLinger in class java.net.Socketjava.net.SocketExceptionpublic final int getSoLinger()
throws java.net.SocketException
getSoLinger in class java.net.Socketjava.net.SocketExceptionpublic final void sendUrgentData(int arg0)
throws java.net.SocketException
sendUrgentData in class java.net.Socketjava.net.SocketExceptionpublic final void setOOBInline(boolean arg0)
throws java.net.SocketException
setOOBInline in class java.net.Socketjava.net.SocketExceptionpublic final boolean getOOBInline()
throws java.net.SocketException
getOOBInline in class java.net.Socketjava.net.SocketExceptionpublic final int getSoTimeout()
throws java.net.SocketException
getSoTimeout in class java.net.Socketjava.net.SocketExceptionpublic final void setSendBufferSize(int arg0)
throws java.net.SocketException
setSendBufferSize in class java.net.Socketjava.net.SocketExceptionpublic final int getSendBufferSize()
throws java.net.SocketException
getSendBufferSize in class java.net.Socketjava.net.SocketExceptionpublic final void setReceiveBufferSize(int arg0)
throws java.net.SocketException
setReceiveBufferSize in class java.net.Socketjava.net.SocketExceptionpublic final int getReceiveBufferSize()
throws java.net.SocketException
getReceiveBufferSize in class java.net.Socketjava.net.SocketExceptionpublic final void setKeepAlive(boolean arg0)
throws java.net.SocketException
setKeepAlive in class java.net.Socketjava.net.SocketExceptionpublic final boolean getKeepAlive()
throws java.net.SocketException
getKeepAlive in class java.net.Socketjava.net.SocketExceptionpublic final void setTrafficClass(int arg0)
throws java.net.SocketException
setTrafficClass in class java.net.Socketjava.net.SocketExceptionpublic final int getTrafficClass()
throws java.net.SocketException
getTrafficClass in class java.net.Socketjava.net.SocketExceptionpublic final void setReuseAddress(boolean arg0)
throws java.net.SocketException
setReuseAddress in class java.net.Socketjava.net.SocketExceptionpublic final boolean getReuseAddress()
throws java.net.SocketException
getReuseAddress in class java.net.Socketjava.net.SocketExceptionpublic void setPerformancePreferences(int arg0,
int arg1,
int arg2)
setPerformancePreferences in class java.net.Socket