code: protected void replaceHandler(ChannelHandlerContext ctx, String hostname, SslContext sslContext) throws Exception {
          SslHandler sslHandler = null;
          try {
              sslHandler = newSslHandler(sslContext, ctx.alloc());
              ctx.pipeline().replace(this, SslHandler.class.getName(), sslHandler);
              sslHandler = null;
          } finally {
              // Since the SslHandler was not inserted into the pipeline the ownership of the SSLEngine was not
              // transferred to the SslHandler.
              // See https://github.com/netty/netty/issues/5678
              if (sslHandler != null) {
                  ReferenceCountUtil.safeRelease(sslHandler.engine());
              }
          }
      }
docs: The default implementation of this method will simply replace {@code this} {@link SniHandler}
  instance with a {@link SslHandler}. Users may override this method to implement custom behavior.
  
  Please be aware that this method may get called after a client has already disconnected and
  custom implementations must take it into consideration when overriding this method.
  
  It's also possible for the hostname argument to be {@code null}.