code: @Nullable
      public static SSLSession findSslSession(@Nullable Channel channel) {
          if (channel == null) {
              return null;
          }
  
          final SslHandler sslHandler = channel.pipeline().get(SslHandler.class);
          return sslHandler != null ? sslHandler.engine().getSession() : null;
      }
docs: Finds the {@link SSLSession} of the current TLS connection.
  
  @return the {@link SSLSession} if found, or {@code null} if not found or {@link Channel} is {@code null}.