• Field Details

    • emptyBuffer

      private static final ByteBuffer emptyBuffer
    • applicationInputBuffer

      private final ByteBuffer applicationInputBuffer
    • networkOutputBuffer

      private final ByteBuffer networkOutputBuffer
    • sslEngine

      private final SSLEngine sslEngine
    • customHostnameVerifier

      private final HostnameVerifier customHostnameVerifier
    • serverHost

      private final String serverHost
    • writeQueue

      private final SslFilter.WriteQueue writeQueue
    • state

      private volatile SslFilter.State state
    • pendingApplicationWrite

      private Runnable pendingApplicationWrite
  • Constructor Details

    • SslFilter

      SslFilter(Filter<ByteBuffer,ByteBuffer,?,?> downstreamFilter, SSLContext sslContext, String serverHost, HostnameVerifier customHostnameVerifier)
      SSL Filter constructor, takes upstream filter as a parameter.
      Parameters:
      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.
  • Method Details

    • write

      void write(ByteBuffer applicationData, CompletionHandler<ByteBuffer> completionHandler)
      Description copied from class: Filter
      Perform write operation for this filter and invokes write method on the next filter in the filter chain.
      Overrides:
      write in class Filter<ByteBuffer,ByteBuffer,ByteBuffer,ByteBuffer>
      Parameters:
      applicationData - on which write operation is performed.
      completionHandler - will be invoked when the write operation is completed or has failed.
    • handleWrite

      private void handleWrite(ByteBuffer applicationData, CompletionHandler<ByteBuffer> completionHandler)
    • handlePostWrite

      private void handlePostWrite(ByteBuffer applicationData, CompletionHandler<ByteBuffer> completionHandler)
    • storePendingApplicationWrite

      private void storePendingApplicationWrite(ByteBuffer applicationData, CompletionHandler<ByteBuffer> completionHandler)
    • close

      void close()
      Description copied from class: Filter
      Close the filter, invokes close operation on the next filter in the filter chain.

      The filter is expected to clean up any allocated resources and pass the invocation to downstream filter.

      Overrides:
      close in class Filter<ByteBuffer,ByteBuffer,ByteBuffer,ByteBuffer>
    • processRead

      boolean processRead(ByteBuffer networkData)
      Description copied from class: Filter
      Overrides:
      processRead in class Filter<ByteBuffer,ByteBuffer,ByteBuffer,ByteBuffer>
      Parameters:
      networkData - read data.
      Returns:
      true if the data should be sent to processing to upper filter in the chain, false otherwise.
    • handleRead

      private boolean handleRead(ByteBuffer networkData)
    • doHandshakeStep

      private boolean doHandshakeStep(ByteBuffer networkData)
    • handleHandshakeFinished

      private void handleHandshakeFinished()
    • handleSslError

      private void handleSslError(Throwable t)
    • startSsl

      void startSsl()
      Description copied from class: Filter
      Signal to turn on SSL, it is passed on in the filter chain until a filter responsible for SSL is reached.
      Overrides:
      startSsl in class Filter<ByteBuffer,ByteBuffer,ByteBuffer,ByteBuffer>
    • rehandshake

      void rehandshake()
      Only for test.
    • getDebugState

      private String getDebugState()
      Returns a printed current state of the SslFilter that could be helpful for troubleshooting.