Class OptionalSslConnectionFactory

    • Constructor Detail

      • OptionalSslConnectionFactory

        public OptionalSslConnectionFactory​(SslConnectionFactory sslConnectionFactory,
                                            java.lang.String otherProtocol)

        Creates a new ConnectionFactory whose connections can upgrade to TLS or another protocol.

        If otherProtocol is null, and the first bytes are not TLS, then otherProtocol(ByteBuffer, EndPoint) is called.

        Parameters:
        sslConnectionFactory - The SslConnectionFactory to use if the first bytes are TLS
        otherProtocol - the protocol of the ConnectionFactory to use if the first bytes are not TLS, or null to explicitly handle the non-TLS case
    • Method Detail

      • seemsTLS

        protected boolean seemsTLS​(java.nio.ByteBuffer buffer)
        Parameters:
        buffer - The buffer with the first bytes of the connection
        Returns:
        whether the bytes seem TLS bytes
      • otherProtocol

        protected void otherProtocol​(java.nio.ByteBuffer buffer,
                                     EndPoint endPoint)

        Callback method invoked when otherProtocol is null and the first bytes are not TLS.

        This typically happens when a client is trying to connect to a TLS port using the http scheme (and not the https scheme).

        Parameters:
        buffer - The buffer with the first bytes of the connection
        endPoint - The connection EndPoint object
        See Also:
        seemsTLS(ByteBuffer)