public class SSLSocketChannel2 extends Object implements ByteChannel, WrappedByteChannel
Modifier and Type | Field and Description |
---|---|
protected int |
bufferallocations
Should be used to count the buffer allocations.
|
protected static ByteBuffer |
emptybuffer
This object is used to feed the
SSLEngine 's wrap and unwrap methods during the handshake phase. |
protected ExecutorService |
exec |
protected ByteBuffer |
inCrypt
encrypted data incoming
|
protected ByteBuffer |
inData
raw payload incomming
|
protected ByteBuffer |
outCrypt
encrypted data outgoing
|
protected SSLEngineResult |
readEngineResult |
protected SelectionKey |
selectionKey
used to set interestOP SelectionKey.OP_WRITE for the underlying channel
|
protected SocketChannel |
socketChannel
the underlying channel
|
protected SSLEngine |
sslEngine |
protected List<Future<?>> |
tasks |
protected SSLEngineResult |
writeEngineResult |
Constructor and Description |
---|
SSLSocketChannel2(SocketChannel channel,
SSLEngine sslEngine,
ExecutorService exec,
SelectionKey key) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
SelectableChannel |
configureBlocking(boolean b) |
boolean |
connect(SocketAddress remote) |
protected void |
consumeDelegatedTasks() |
protected void |
createBuffers(SSLSession session) |
boolean |
finishConnect() |
boolean |
isBlocking()
This function returns the blocking state of the channel
|
boolean |
isConnected() |
boolean |
isInboundDone() |
boolean |
isNeedRead()
returns whether readMore should be called to fetch data which has been decoded but not yet been returned.
|
boolean |
isNeedWrite()
returns whether writeMore should be called write additional data.
|
boolean |
isOpen() |
int |
read(ByteBuffer dst)
Blocks when in blocking mode until at least one byte has been decoded.
|
int |
readMore(ByteBuffer dst)
This function does not read data from the underlying channel at all.
|
Socket |
socket() |
int |
write(ByteBuffer src) |
void |
writeMore()
Gets called when
WrappedByteChannel.isNeedWrite() ()} requires a additional rite |
protected static ByteBuffer emptybuffer
SSLEngine
's wrap and unwrap methods during the handshake phase.protected ExecutorService exec
protected ByteBuffer inData
protected ByteBuffer outCrypt
protected ByteBuffer inCrypt
protected SocketChannel socketChannel
protected SelectionKey selectionKey
protected SSLEngine sslEngine
protected SSLEngineResult readEngineResult
protected SSLEngineResult writeEngineResult
protected int bufferallocations
createBuffers(SSLSession)
needs to be called.public SSLSocketChannel2(SocketChannel channel, SSLEngine sslEngine, ExecutorService exec, SelectionKey key) throws IOException
IOException
protected void consumeDelegatedTasks()
protected void createBuffers(SSLSession session)
public int write(ByteBuffer src) throws IOException
write
in interface WritableByteChannel
IOException
public int read(ByteBuffer dst) throws IOException
read
in interface ReadableByteChannel
IOException
public boolean isConnected()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
IOException
public SelectableChannel configureBlocking(boolean b) throws IOException
IOException
public boolean connect(SocketAddress remote) throws IOException
IOException
public boolean finishConnect() throws IOException
IOException
public Socket socket()
public boolean isInboundDone()
public boolean isNeedWrite()
WrappedByteChannel
isNeedWrite
in interface WrappedByteChannel
public void writeMore() throws IOException
WrappedByteChannel
WrappedByteChannel.isNeedWrite()
()} requires a additional ritewriteMore
in interface WrappedByteChannel
IOException
- may be thrown due to an error while writingpublic boolean isNeedRead()
WrappedByteChannel
isNeedRead
in interface WrappedByteChannel
ReadableByteChannel.read(ByteBuffer)
,
WrappedByteChannel.readMore(ByteBuffer)
public int readMore(ByteBuffer dst) throws SSLException
WrappedByteChannel
ReadableByteChannel.read(ByteBuffer)
.readMore
in interface WrappedByteChannel
dst
- the destiny of the readSSLException
public boolean isBlocking()
WrappedByteChannel
isBlocking
in interface WrappedByteChannel
Copyright © 2018. All rights reserved.