public class SSLSocket extends Socket
DEFAULT_OPEN_TIMEOUT, DEFAULT_READ_TIMEOUT, DEFAULT_WRITE_TIMEOUT, readTimeout, writeTimeoutskipBuffer| Constructor and Description |
|---|
SSLSocket(java.lang.String host,
int port,
int timeout)
Constructs an SSL connection to a named host at a specified port, with the specified connection timeout, binding
the client side of the connection a given address and port.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the socket.
|
protected SSLClient |
prepareContext()
Creates a new SSLClient to be used by this instance of SSLSocket during the handshake.
|
int |
readBytes(byte[] buf)
Reads bytes from the socket into a byte array, from offset 0 to
buf.length.
|
int |
readBytes(byte[] buf,
int start,
int count)
Reads bytes from the socket into a byte array.
|
void |
startHandshake()
Starts an SSL handshake on this connection.
|
int |
writeBytes(byte[] buf,
int start,
int count)
Writes to the socket.
|
finalize, getHost, getNativeSocket, getPort, readLineasInputStream, asOutputStream, asStream, asStream, skipBytes, wrapInputStream, wrapInputStreamToStream, write, writeBytes, writeBytes, writeBytespublic SSLSocket(java.lang.String host,
int port,
int timeout)
throws UnknownHostException,
IOException
host - the server's hostport - its porttimeout - the timeout for this operationUnknownHostException - if the host is not knownIOException - if an I/O error occurs when creating the socketprotected SSLClient prepareContext() throws CryptoException
CryptoExceptionpublic void startHandshake()
throws IOException
IOException - on a network level errorpublic int readBytes(byte[] buf,
int start,
int count)
throws IOException
SocketreadBytes in class Socketbuf - the byte array to read data intostart - the start position in the byte arraycount - the number of bytes to readIOExceptionpublic int readBytes(byte[] buf)
throws IOException
SocketreadBytes in class Socketbuf - the byte array to read data intoIOExceptionSocket.readBytes(byte[], int, int)public int writeBytes(byte[] buf,
int start,
int count)
throws IOException
SocketwriteBytes in class Socketbuf - the byte array to write data fromstart - the start position in the byte arraycount - the number of bytes to writeIOExceptionpublic void close()
throws IOException
Socketclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class SocketIOException - If an I/O error occurs.