public class OpenSSLSocketImplWrapper extends OpenSSLSocketImpl
| Modifier | Constructor and Description |
|---|---|
protected |
OpenSSLSocketImplWrapper(Socket socket,
String hostname,
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. |
void |
connect(SocketAddress sockaddr)
Connects this socket to the given remote host address and port specified
by the SocketAddress
remoteAddr. |
void |
connect(SocketAddress sockaddr,
int timeout)
Connects this socket to the given remote host address and port specified
by the SocketAddress
remoteAddr with the specified timeout. |
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 an address for which
InetAddress.isAnyLocalAddress() returns true if the socket is closed or 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
has never been bound.
|
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. |
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, chooseClientAlias, chooseClientPSKIdentity, chooseServerAlias, chooseServerPSKIdentityHint, clientCertificateRequested, clientPSKKeyRequested, close, finalize, getAlpnSelectedProtocol, getChannelId, getEnabledCipherSuites, getEnabledProtocols, getEnableSessionCreation, getFileDescriptor$, getInputStream, getNeedClientAuth, getNpnSelectedProtocol, getOutputStream, getPSKKey, getSession, getSoWriteTimeout, getSupportedCipherSuites, getSupportedProtocols, getUseClientMode, getWantClientAuth, onSSLStateChange, removeHandshakeCompletedListener, sendUrgentData, serverPSKKeyRequested, setAlpnProtocols, setChannelIdEnabled, setChannelIdPrivateKey, setEnabledCipherSuites, setEnabledProtocols, setEnableSessionCreation, setHandshakeTimeout, setHostname, setNeedClientAuth, setNpnProtocols, setOOBInline, setSoWriteTimeout, setUseClientMode, setUseSessionTickets, setWantClientAuth, startHandshake, verifyCertificateChaingetSSLParameters, setSSLParameters, shutdownInput, shutdownOutputgetChannel, getReusePort, onBind, onClose, onConnect, setPerformancePreferences, setReusePort, setSocketImplFactoryprotected OpenSSLSocketImplWrapper(Socket socket, String hostname, int port, boolean autoClose, SSLParametersImpl sslParameters) throws IOException
IOExceptionpublic void connect(SocketAddress sockaddr, int timeout) throws IOException
SocketremoteAddr with the specified timeout. The
connecting method will block until the connection is established or an
error occurred.connect in class Socketsockaddr - 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.public void connect(SocketAddress sockaddr) throws IOException
SocketremoteAddr.connect in class Socketsockaddr - the address and port of the remote host to connect to.IOException - if the socket is already connected or an error occurs while
connecting.public void bind(SocketAddress sockaddr) throws IOException
SocketlocalAddr. If localAddr is set to
null, this socket will be bound to an available local address on
any free port.bind in class Socketsockaddr - 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()
SocketSocketAddress or null if the socket is not connected.getRemoteSocketAddress in class Socketpublic SocketAddress getLocalSocketAddress()
SocketInetAddress.isAnyLocalAddress() returns true will be returned with the
previously-bound port. This is useful on multihomed hosts.getLocalSocketAddress in class Socketpublic InetAddress getLocalAddress()
SocketInetAddress.isAnyLocalAddress() returns true if the socket is closed or unbound.getLocalAddress in class Socketpublic InetAddress getInetAddress()
SocketgetInetAddress in class Socketpublic String toString()
SocketString containing a concise, human-readable description of the
socket.public void setSoLinger(boolean on,
int linger)
throws SocketException
SocketsetSoLinger in class SocketSocketExceptionpublic void setTcpNoDelay(boolean on)
throws SocketException
SocketSocketOptions.TCP_NODELAY option.setTcpNoDelay in class SocketSocketExceptionpublic void setReuseAddress(boolean on)
throws SocketException
SocketSocketOptions.SO_REUSEADDR option.setReuseAddress in class SocketSocketExceptionpublic void setKeepAlive(boolean on)
throws SocketException
SocketSocketOptions.SO_KEEPALIVE option.setKeepAlive in class SocketSocketExceptionpublic void setTrafficClass(int tos)
throws SocketException
SocketSocketOptions.IP_TOS value for every packet sent by this socket.setTrafficClass in class SocketSocketExceptionpublic void setSoTimeout(int to)
throws SocketException
Socketread 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 OpenSSLSocketImplSocketExceptionpublic void setSendBufferSize(int size)
throws SocketException
Socketsend buffer size.setSendBufferSize in class SocketSocketExceptionpublic void setReceiveBufferSize(int size)
throws SocketException
Socketreceive buffer size.setReceiveBufferSize in class SocketSocketExceptionpublic boolean getTcpNoDelay()
throws SocketException
SocketSocketOptions#TCP_NODELAY setting.getTcpNoDelay in class SocketSocketExceptionpublic boolean getReuseAddress()
throws SocketException
SocketSocketOptions.SO_REUSEADDR setting.getReuseAddress in class SocketSocketExceptionpublic boolean getOOBInline()
throws SocketException
SocketSocketOptions.SO_OOBINLINE setting.getOOBInline in class SocketSocketExceptionpublic boolean getKeepAlive()
throws SocketException
SocketSocketOptions.SO_KEEPALIVE setting.getKeepAlive in class SocketSocketExceptionpublic int getTrafficClass()
throws SocketException
SocketSocketOptions.IP_TOS setting.getTrafficClass in class SocketSocketExceptionpublic int getSoTimeout()
throws SocketException
Socketreceive timeout.getSoTimeout in class OpenSSLSocketImplSocketExceptionpublic int getSoLinger()
throws SocketException
Socketlinger timeout in seconds, or -1
for no linger (i.e. close will return immediately).getSoLinger in class SocketSocketExceptionpublic int getSendBufferSize()
throws SocketException
Socketsend buffer size.getSendBufferSize in class SocketSocketExceptionpublic int getReceiveBufferSize()
throws SocketException
Socketreceive buffer size.getReceiveBufferSize in class SocketSocketExceptionpublic boolean isConnected()
SocketisConnected in class Sockettrue if the socket is connected, false otherwise.public boolean isClosed()
Socketpublic boolean isBound()
Socketpublic boolean isOutputShutdown()
SocketisOutputShutdown in class Sockettrue if writing to this socket is not possible anymore,
false otherwise.public boolean isInputShutdown()
SocketisInputShutdown in class Sockettrue if reading from this socket is not possible anymore,
false otherwise.public int getPort()
SocketgetPort in class OpenSSLSocketImplpublic int getLocalPort()
SocketgetLocalPort in class Socket