public class TlsProtocolHandler extends Object
Constructor and Description |
---|
TlsProtocolHandler(InputStream is,
OutputStream os) |
TlsProtocolHandler(InputStream is,
OutputStream os,
SecureRandom sr) |
Modifier and Type | Method and Description |
---|---|
protected void |
assertEmpty(ByteArrayInputStream is)
Make sure the InputStream is now empty.
|
void |
close()
Closes this connection.
|
void |
connect(CertificateVerifyer verifyer)
Deprecated.
use version taking TlsClient
|
void |
connect(TlsClient tlsClient)
Connects to the remote system using client authentication
|
protected void |
flush() |
InputStream |
getInputStream() |
OutputStream |
getOutputStream() |
protected void |
processData(short protocol,
byte[] buf,
int offset,
int len) |
protected int |
readApplicationData(byte[] buf,
int offset,
int len)
Read data from the network.
|
protected void |
writeData(byte[] buf,
int offset,
int len)
Send some application data to the remote system.
|
public TlsProtocolHandler(InputStream is, OutputStream os)
public TlsProtocolHandler(InputStream is, OutputStream os, SecureRandom sr)
protected void processData(short protocol, byte[] buf, int offset, int len) throws IOException
IOException
public void connect(CertificateVerifyer verifyer) throws IOException
verifyer
- Will be used when a certificate is received to verify that this
certificate is accepted by the client.IOException
- If handshake was not successful.public void connect(TlsClient tlsClient) throws IOException
tlsClient
- IOException
- If handshake was not successful.protected int readApplicationData(byte[] buf, int offset, int len) throws IOException
buf
- The buffer where the data will be copied to.offset
- The position where the data will be placed in the buffer.len
- The maximum number of bytes to read.IOException
- If something goes wrong during reading data.protected void writeData(byte[] buf, int offset, int len) throws IOException
buf
- The buffer with the data.offset
- The position in the buffer where the data is placed.len
- The length of the data.IOException
- If something goes wrong during sending.public OutputStream getOutputStream()
public InputStream getInputStream()
public void close() throws IOException
IOException
- If something goes wrong during closing.protected void assertEmpty(ByteArrayInputStream is) throws IOException
is
- The InputStream to check.IOException
- If is is not empty.protected void flush() throws IOException
IOException
Copyright © 2015. All rights reserved.