Connection like HttpConnection) that
wants unencrypted data.
The connector uses an EndPoint (typically SocketChannelEndPoint) as
it's source/sink of encrypted data. It then provides an endpoint via getSslEndPoint() to
expose a source/sink of unencrypted data to another connection (eg HttpConnection).
The design of this class is based on a clear separation between the passive methods, which do not block nor schedule any asynchronous callbacks, and active methods that do schedule asynchronous callbacks.
The passive methods are SslEndPoint#fill(ByteBuffer) and SslEndPoint#flush(ByteBuffer.. They make best
effort attempts to progress the connection using only calls to the encrypted EndPoint#fill(ByteBuffer) and EndPoint#flush(ByteBuffer.
methods. They will never block nor schedule any readInterest or write callbacks. If a fill/flush cannot progress either because
of network congestion or waiting for an SSL handshake message, then the fill/flush will simply return with zero bytes filled/flushed.
Specifically, if a flush cannot proceed because it needs to receive a handshake message, then the flush will attempt to fill bytes from the
encrypted endpoint, but if insufficient bytes are read it will NOT call EndPoint#fillInterested(Callback).
It is only the active methods : SslEndPoint#fillInterested(Callback) and
SslEndPoint#write(Callback, ByteBuffer. that may schedule callbacks by calling the encrypted
EndPoint#fillInterested(Callback) and EndPoint#write(Callback, ByteBuffer.
methods. For normal data handling, the decrypted fillInterest method will result in an encrypted fillInterest and a decrypted
write will result in an encrypted write. However, due to SSL handshaking requirements, it is also possible for a decrypted fill
to call the encrypted write and for the decrypted flush to call the encrypted fillInterested methods.
MOST IMPORTANTLY, the encrypted callbacks from the active methods (#onFillable() and WriteFlusher#completeWrite()) do no filling or flushing themselves. Instead they simple make the callbacks to the decrypted callbacks, so that the passive encrypted fill/flush will be called again and make another best effort attempt to progress the connection.
| Modifier and Type | Class and Description |
|---|---|
| private static enum | |
| private static enum | |
| private static enum | |
| private abstract class | |
| public class |
| Modifier and Type | Field and Description |
|---|---|
| private final ByteBufferPool | |
| private final AtomicLong | |
| private final AtomicLong | |
| private boolean | |
| private final boolean | |
| private RetainableByteBuffer | |
| private final boolean | |
| private RetainableByteBuffer | |
| private RetainableByteBuffer | |
| private SslConnection. | |
| private SslConnection. | |
| private final AtomicReference | |
| private final AutoLock | |
| private boolean | |
| private int | |
| private boolean | |
| private final Runnable | |
| private final SslContextFactory | |
| private final SslConnection. | |
| private final SSLEngine | |
| private final Callback | |
| private boolean | |
| private final List | |
| private static final Logger | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| public | SslConnection(ByteBufferPool byteBufferPool, Executor executor, EndPoint endPoint, SSLEngine sslEngine)
Deprecated
|
| public | SslConnection(ByteBufferPool byteBufferPool, Executor executor, SslContextFactory sslContextFactory, EndPoint endPoint, SSLEngine sslEngine)
|
| public | SslConnection(ByteBufferPool byteBufferPool, Executor executor, EndPoint endPoint, SSLEngine sslEngine, boolean useDirectBuffersForEncryption, boolean useDirectBuffersForDecryption)
Deprecated
|
| public | SslConnection(ByteBufferPool byteBufferPool, Executor executor, SslContextFactory sslContextFactory, EndPoint endPoint, SSLEngine sslEngine, boolean useDirectBuffersForEncryption, boolean useDirectBuffersForDecryption)
|
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| public void | |
| public void | close()
Overrides org. Implements org. Performs a logical close of this connection. |
| private void | |
| private void | |
| private int | |
| private int | |
| public long | getBytesIn()
Overrides org. Implements org. |
| public long | |
| private int | |
| public int | Returns: The number of renegotiations allowed for this connection. When the limit is 0 renegotiation will be denied. If the limit is less than 0 then no limit is applied.
|
| public SslConnection. | |
| public SSLEngine | |
| private boolean | |
| private boolean | |
| private boolean | |
| public boolean | |
| public boolean | |
| protected int | |
| protected boolean | |
| protected SslConnection. | |
| public void | onClose(Throwable
The cause of the close or null for a normal close cause)Overrides org. Implements org. Callback method invoked when this connection is closed. |
| public void | onFillable()
Implements abstract org. Callback method invoked when the endpoint is ready to be read. |
| public void | onFillInterestedFailed(Throwable
the exception that caused the failure cause)Overrides org. Callback method invoked when the endpoint failed to be ready to be read. |
| public boolean | onIdleExpired(TimeoutException timeoutException)
Overrides org. Implements org. Callback method invoked upon an idle timeout event. |
| public void | onOpen()
Overrides org. Implements org. Callback method invoked when this connection is opened. |
| public void | onUpgradeTo(ByteBuffer
a non-null buffer of unconsumed bytes received from
the upgrade-from connection.
The buffer does not belong to any pool and should be discarded after
having consumed its bytes. buffer)Implements org. Invoked during an |
| private void | |
| private void | |
| private void | |
| private void | |
| public boolean | |
| public void | |
| public void | setRenegotiationLimit(int
The number of renegotiations allowed for this connection.
When the limit is 0 renegotiation will be denied. If the limit is less than 0 then no limit is applied.
Default -1. renegotiationLimit)
|
| public void | setRequireCloseMessage(boolean
whether peers must send the TLS requireCloseMessage)close_notify messageSets whether it is required that a peer send the TLS |
| public String | |
| protected SSLEngineResult | |
| protected SSLEngineResult |