public class SSLSocketWrapper extends SSLSocketImpl
input, output, recordProtocol, sslParameters
Modifier | Constructor and Description |
---|---|
protected |
SSLSocketWrapper(Socket socket,
String host,
int port,
boolean autoClose,
SSLParametersImpl sslParameters) |
Modifier and Type | Method and Description |
---|---|
void |
bind(SocketAddress sockaddr)
Binds this socket to the given local host address and port specified by
the SocketAddress
localAddr . |
protected void |
closeTransportLayer()
Closes the transport data streams.
|
void |
connect(SocketAddress sockaddr)
This method works according to the specification of implemented class.
|
void |
connect(SocketAddress sockaddr,
int timeout)
This method works according to the specification of implemented class.
|
FileDescriptor |
getFileDescriptor$() |
InetAddress |
getInetAddress()
Returns the IP address of the target host this socket is connected to, or null if this
socket is not yet connected.
|
boolean |
getKeepAlive()
Returns this socket's
SocketOptions.SO_KEEPALIVE setting. |
InetAddress |
getLocalAddress()
Returns the local IP address this socket is bound to, or
InetAddress.ANY if
the socket is unbound. |
int |
getLocalPort()
Returns the local port this socket is bound to, or -1 if the socket is unbound.
|
SocketAddress |
getLocalSocketAddress()
Returns the local address and port of this socket as a SocketAddress or
null if the socket is unbound.
|
boolean |
getOOBInline()
Returns this socket's
SocketOptions.SO_OOBINLINE setting. |
int |
getPort()
Returns the port number of the target host this socket is connected to, or 0 if this socket
is not yet connected.
|
int |
getReceiveBufferSize()
Returns this socket's
receive buffer size . |
SocketAddress |
getRemoteSocketAddress()
Returns the remote address and port of this socket as a
SocketAddress or null if the socket is not connected. |
boolean |
getReuseAddress()
Returns this socket's
SocketOptions.SO_REUSEADDR setting. |
int |
getSendBufferSize()
Returns this socket's
send buffer size . |
int |
getSoLinger()
Returns this socket's
linger timeout in seconds, or -1
for no linger (i.e. |
int |
getSoTimeout()
Returns this socket's
receive timeout . |
boolean |
getTcpNoDelay()
Returns this socket's
SocketOptions#TCP_NODELAY setting. |
int |
getTrafficClass()
Returns this socket's
SocketOptions.IP_TOS setting. |
protected void |
initTransportLayer()
Initialize the transport data streams.
|
boolean |
isBound()
Returns whether this socket is bound to a local address and port.
|
boolean |
isClosed()
Returns whether this socket is closed.
|
boolean |
isConnected()
Returns whether this socket is connected to a remote host.
|
boolean |
isInputShutdown()
Returns whether the incoming channel of the socket has already been
closed.
|
boolean |
isOutputShutdown()
Returns whether the outgoing channel of the socket has already been
closed.
|
void |
setKeepAlive(boolean on)
Sets this socket's
SocketOptions.SO_KEEPALIVE option. |
void |
setReceiveBufferSize(int size)
Sets this socket's
receive buffer size . |
void |
setReuseAddress(boolean on)
Sets this socket's
SocketOptions.SO_REUSEADDR option. |
void |
setSendBufferSize(int size)
Sets this socket's
send buffer size . |
void |
setSoLinger(boolean on,
int linger)
Sets this socket's
linger timeout in seconds. |
void |
setSoTimeout(int to)
Sets this socket's
read timeout in milliseconds. |
void |
setTcpNoDelay(boolean on)
Sets this socket's
SocketOptions.TCP_NODELAY option. |
void |
setTrafficClass(int tos)
Sets this socket's
SocketOptions.IP_TOS value for every packet sent by this socket. |
String |
toString()
Returns a
String containing a concise, human-readable description of the
socket. |
addHandshakeCompletedListener, close, getEnabledCipherSuites, getEnabledProtocols, getEnableSessionCreation, getInputStream, getNeedClientAuth, getOutputStream, getSession, getSupportedCipherSuites, getSupportedProtocols, getUseClientMode, getWantClientAuth, init, needAppData, removeHandshakeCompletedListener, sendUrgentData, setEnabledCipherSuites, setEnabledProtocols, setEnableSessionCreation, setNeedClientAuth, setOOBInline, setUseClientMode, setWantClientAuth, startHandshake, writeAppData
getSSLParameters, setSSLParameters, shutdownInput, shutdownOutput
getChannel, setPerformancePreferences, setSocketImplFactory
protected SSLSocketWrapper(Socket socket, String host, int port, boolean autoClose, SSLParametersImpl sslParameters) throws IOException
IOException
protected void initTransportLayer() throws IOException
SSLSocketImpl
initTransportLayer
in class SSLSocketImpl
IOException
protected void closeTransportLayer() throws IOException
SSLSocketImpl
closeTransportLayer
in class SSLSocketImpl
IOException
public void connect(SocketAddress sockaddr, int timeout) throws IOException
SSLSocketImpl
connect
in class SSLSocketImpl
sockaddr
- the address and port of the remote host to connect to.timeout
- the timeout value in milliseconds or 0
for an infinite
timeout.IOException
- if the socket is already connected or an error occurs while
connecting.method documentation for more information
public void connect(SocketAddress sockaddr) throws IOException
SSLSocketImpl
connect
in class SSLSocketImpl
sockaddr
- the address and port of the remote host to connect to.IOException
- if the socket is already connected or an error occurs while
connecting.method documentation for more information
public void bind(SocketAddress sockaddr) throws IOException
Socket
localAddr
. If localAddr
is set to
null
, this socket will be bound to an available local address on
any free port.bind
in class Socket
sockaddr
- the specific address and port on the local machine to bind to.IOException
- if the socket is already bound or an error occurs while
binding.public SocketAddress getRemoteSocketAddress()
Socket
SocketAddress
or null if the socket is not connected.getRemoteSocketAddress
in class Socket
public SocketAddress getLocalSocketAddress()
Socket
getLocalSocketAddress
in class Socket
public InetAddress getLocalAddress()
Socket
InetAddress.ANY
if
the socket is unbound.getLocalAddress
in class Socket
public InetAddress getInetAddress()
Socket
getInetAddress
in class Socket
public String toString()
Socket
String
containing a concise, human-readable description of the
socket.public void setSoLinger(boolean on, int linger) throws SocketException
Socket
setSoLinger
in class Socket
SocketException
public void setTcpNoDelay(boolean on) throws SocketException
Socket
SocketOptions.TCP_NODELAY
option.setTcpNoDelay
in class Socket
SocketException
public void setReuseAddress(boolean on) throws SocketException
Socket
SocketOptions.SO_REUSEADDR
option.setReuseAddress
in class Socket
SocketException
public void setKeepAlive(boolean on) throws SocketException
Socket
SocketOptions.SO_KEEPALIVE
option.setKeepAlive
in class Socket
SocketException
public void setTrafficClass(int tos) throws SocketException
Socket
SocketOptions.IP_TOS
value for every packet sent by this socket.setTrafficClass
in class Socket
SocketException
public void setSoTimeout(int to) throws SocketException
Socket
read timeout
in milliseconds.
Use 0 for no timeout.
To take effect, this option must be set before the blocking method was called.setSoTimeout
in class Socket
SocketException
public void setSendBufferSize(int size) throws SocketException
Socket
send buffer size
.setSendBufferSize
in class Socket
SocketException
public void setReceiveBufferSize(int size) throws SocketException
Socket
receive buffer size
.setReceiveBufferSize
in class Socket
SocketException
public boolean getTcpNoDelay() throws SocketException
Socket
SocketOptions#TCP_NODELAY
setting.getTcpNoDelay
in class Socket
SocketException
public boolean getReuseAddress() throws SocketException
Socket
SocketOptions.SO_REUSEADDR
setting.getReuseAddress
in class Socket
SocketException
public boolean getOOBInline() throws SocketException
Socket
SocketOptions.SO_OOBINLINE
setting.getOOBInline
in class Socket
SocketException
public boolean getKeepAlive() throws SocketException
Socket
SocketOptions.SO_KEEPALIVE
setting.getKeepAlive
in class Socket
SocketException
public int getTrafficClass() throws SocketException
Socket
SocketOptions.IP_TOS
setting.getTrafficClass
in class Socket
SocketException
public int getSoTimeout() throws SocketException
Socket
receive timeout
.getSoTimeout
in class Socket
SocketException
public int getSoLinger() throws SocketException
Socket
linger
timeout in seconds, or -1
for no linger (i.e. close
will return immediately).getSoLinger
in class Socket
SocketException
public int getSendBufferSize() throws SocketException
Socket
send buffer size
.getSendBufferSize
in class Socket
SocketException
public int getReceiveBufferSize() throws SocketException
Socket
receive buffer size
.getReceiveBufferSize
in class Socket
SocketException
public boolean isConnected()
Socket
isConnected
in class Socket
true
if the socket is connected, false
otherwise.public boolean isClosed()
Socket
public boolean isBound()
Socket
public boolean isOutputShutdown()
Socket
isOutputShutdown
in class Socket
true
if writing to this socket is not possible anymore,
false
otherwise.public boolean isInputShutdown()
Socket
isInputShutdown
in class Socket
true
if reading from this socket is not possible anymore,
false
otherwise.public int getPort()
Socket
public int getLocalPort()
Socket
getLocalPort
in class Socket
public FileDescriptor getFileDescriptor$()
getFileDescriptor$
in class Socket