class SslFilter extends Filter<java.nio.ByteBuffer,java.nio.ByteBuffer,java.nio.ByteBuffer,java.nio.ByteBuffer>
Modifier and Type | Class and Description |
---|---|
private class |
SslFilter.LazyBuffer |
private static class |
SslFilter.State |
private class |
SslFilter.WriteQueue |
Modifier and Type | Field and Description |
---|---|
private java.nio.ByteBuffer |
applicationInputBuffer |
private javax.net.ssl.HostnameVerifier |
customHostnameVerifier |
private static java.nio.ByteBuffer |
emptyBuffer |
private java.nio.ByteBuffer |
networkOutputBuffer |
private java.lang.Runnable |
pendingApplicationWrite |
private java.lang.String |
serverHost |
private javax.net.ssl.SSLEngine |
sslEngine |
private SslFilter.State |
state |
private SslFilter.WriteQueue |
writeQueue |
downstreamFilter, upstreamFilter
Constructor and Description |
---|
SslFilter(Filter<java.nio.ByteBuffer,java.nio.ByteBuffer,?,?> downstreamFilter,
javax.net.ssl.SSLContext sslContext,
java.lang.String serverHost,
javax.net.ssl.HostnameVerifier customHostnameVerifier)
SSL Filter constructor, takes upstream filter as a parameter.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
close()
Close the filter, invokes close operation on the next filter in the filter chain.
|
private boolean |
doHandshakeStep(java.nio.ByteBuffer networkData) |
private java.lang.String |
getDebugState()
Returns a printed current state of the SslFilter that could be helpful for troubleshooting.
|
private void |
handleHandshakeFinished() |
private void |
handlePostWrite(java.nio.ByteBuffer applicationData,
CompletionHandler<java.nio.ByteBuffer> completionHandler) |
private boolean |
handleRead(java.nio.ByteBuffer networkData) |
private void |
handleSslError(java.lang.Throwable t) |
private void |
handleWrite(java.nio.ByteBuffer applicationData,
CompletionHandler<java.nio.ByteBuffer> completionHandler) |
(package private) boolean |
processRead(java.nio.ByteBuffer networkData)
Process
Filter.onRead(Object) . |
(package private) void |
rehandshake()
Only for test.
|
(package private) void |
startSsl()
Signal to turn on SSL, it is passed on in the filter chain until a filter responsible for SSL is reached.
|
private void |
storePendingApplicationWrite(java.nio.ByteBuffer applicationData,
CompletionHandler<java.nio.ByteBuffer> completionHandler) |
(package private) void |
write(java.nio.ByteBuffer applicationData,
CompletionHandler<java.nio.ByteBuffer> completionHandler)
Perform write operation for this filter and invokes write method on the next filter in the filter chain.
|
connect, handleConnect, onConnect, onConnectionClosed, onError, onRead, onSslHandshakeCompleted, processConnect, processConnectionClosed, processError, processSslHandshakeCompleted
private static final java.nio.ByteBuffer emptyBuffer
private final java.nio.ByteBuffer applicationInputBuffer
private final java.nio.ByteBuffer networkOutputBuffer
private final javax.net.ssl.SSLEngine sslEngine
private final javax.net.ssl.HostnameVerifier customHostnameVerifier
private final java.lang.String serverHost
private final SslFilter.WriteQueue writeQueue
private volatile SslFilter.State state
private java.lang.Runnable pendingApplicationWrite
SslFilter(Filter<java.nio.ByteBuffer,java.nio.ByteBuffer,?,?> downstreamFilter, javax.net.ssl.SSLContext sslContext, java.lang.String serverHost, javax.net.ssl.HostnameVerifier customHostnameVerifier)
downstreamFilter
- a filter that is positioned under the SSL filter.sslContext
- configuration of SSL engine.serverHost
- server host (hostname or IP address), which will be used to verify authenticity of
the server (the provided host will be compared against the host in the certificate
provided by the server). IP address and hostname cannot be used interchangeably -
if a certificate contains hostname and an IP address of the server is provided here,
the verification will fail.customHostnameVerifier
- hostname verifier that will be used instead of the default one.void write(java.nio.ByteBuffer applicationData, CompletionHandler<java.nio.ByteBuffer> completionHandler)
Filter
private void handleWrite(java.nio.ByteBuffer applicationData, CompletionHandler<java.nio.ByteBuffer> completionHandler)
private void handlePostWrite(java.nio.ByteBuffer applicationData, CompletionHandler<java.nio.ByteBuffer> completionHandler)
private void storePendingApplicationWrite(java.nio.ByteBuffer applicationData, CompletionHandler<java.nio.ByteBuffer> completionHandler)
void close()
Filter
boolean processRead(java.nio.ByteBuffer networkData)
Filter
Filter.onRead(Object)
.processRead
in class Filter<java.nio.ByteBuffer,java.nio.ByteBuffer,java.nio.ByteBuffer,java.nio.ByteBuffer>
networkData
- read data.true
if the data should be sent to processing to upper filter in the chain, false
otherwise.Filter.onRead(Object).
private boolean handleRead(java.nio.ByteBuffer networkData)
private boolean doHandshakeStep(java.nio.ByteBuffer networkData)
private void handleHandshakeFinished()
private void handleSslError(java.lang.Throwable t)
void startSsl()
Filter
void rehandshake()
private java.lang.String getDebugState()