Class NettyPipelineSslUtils
java.lang.Object
io.servicetalk.transport.netty.internal.NettyPipelineSslUtils
Utilities for
ChannelPipeline
and SSL/TLS.-
Method Summary
Modifier and TypeMethodDescriptionstatic SSLSession
extractSslSession
(io.netty.channel.ChannelPipeline pipeline, io.netty.handler.ssl.SslHandshakeCompletionEvent sslEvent, Consumer<Throwable> failureConsumer) Extracts theSSLSession
from theChannelPipeline
if theSslHandshakeCompletionEvent
is successful or propagate the failure tofailureConsumer
.static SSLSession
extractSslSession
(SslConfig sslConfig, io.netty.channel.ChannelPipeline pipeline) Extracts theSSLSession
from theChannelPipeline
if the handshake is already done.static SSLSession
extractSslSessionAndReport
(io.netty.channel.ChannelPipeline pipeline, io.netty.handler.ssl.SslHandshakeCompletionEvent sslEvent, Consumer<Throwable> failureConsumer, boolean shouldReport) Deprecated.static SSLSession
extractSslSessionAndReport
(SslConfig sslConfig, io.netty.channel.ChannelPipeline pipeline, ConnectionObserver connectionObserver) Deprecated.UseextractSslSession(SslConfig, ChannelPipeline)
instead, reporting toConnectionObserver.SecurityHandshakeObserver
is handled automatically for allSslHandler
s initialized bySslClientChannelInitializer
orSslServerChannelInitializer
static boolean
isSslEnabled
(io.netty.channel.ChannelPipeline pipeline) Deprecated.not required anymore, will be removed in the future releases, seeextractSslSessionAndReport(SslConfig, ChannelPipeline, ConnectionObserver)
for an alternative approach
-
Method Details
-
isSslEnabled
Deprecated.not required anymore, will be removed in the future releases, seeextractSslSessionAndReport(SslConfig, ChannelPipeline, ConnectionObserver)
for an alternative approachDetermine if theChannelPipeline
is configured for SSL/TLS.- Parameters:
pipeline
- The pipeline to check.- Returns:
true
if the pipeline is configured to use SSL/TLS.
-
extractSslSessionAndReport
@Nullable @Deprecated public static SSLSession extractSslSessionAndReport(@Nullable SslConfig sslConfig, io.netty.channel.ChannelPipeline pipeline, ConnectionObserver connectionObserver) Deprecated.UseextractSslSession(SslConfig, ChannelPipeline)
instead, reporting toConnectionObserver.SecurityHandshakeObserver
is handled automatically for allSslHandler
s initialized bySslClientChannelInitializer
orSslServerChannelInitializer
Extracts theSSLSession
from theChannelPipeline
if the handshake is already done and reports the result toConnectionObserver.SecurityHandshakeObserver
if available. If it's done but failed, it rethrows the result.- Parameters:
sslConfig
-SslConfig
if SSL/TLS is expectedpipeline
-ChannelPipeline
which contains a handler containing theSSLSession
connectionObserver
-ConnectionObserver
in case the handshake status should be reported- Returns:
- The
SSLSession
ornull
if none can be found - Throws:
IllegalStateException
- ifSslHandler
can not be found in theChannelPipeline
-
extractSslSession
@Nullable public static SSLSession extractSslSession(@Nullable SslConfig sslConfig, io.netty.channel.ChannelPipeline pipeline) Extracts theSSLSession
from theChannelPipeline
if the handshake is already done. If it's done but failed, it rethrows the result.- Parameters:
sslConfig
-SslConfig
if SSL/TLS is expectedpipeline
-ChannelPipeline
which contains a handler containing theSSLSession
- Returns:
- The
SSLSession
ornull
if none can be found - Throws:
IllegalStateException
- ifSslHandler
can not be found in theChannelPipeline
-
extractSslSessionAndReport
@Nullable @Deprecated public static SSLSession extractSslSessionAndReport(io.netty.channel.ChannelPipeline pipeline, io.netty.handler.ssl.SslHandshakeCompletionEvent sslEvent, Consumer<Throwable> failureConsumer, boolean shouldReport) Deprecated.UseextractSslSession(ChannelPipeline, SslHandshakeCompletionEvent, Consumer)
instead, reporting toConnectionObserver.SecurityHandshakeObserver
is handled automatically for allSslHandler
s initialized bySslClientChannelInitializer
orSslServerChannelInitializer
.Extracts theSSLSession
from theChannelPipeline
if theSslHandshakeCompletionEvent
is successful and reports the result toConnectionObserver.SecurityHandshakeObserver
if available.- Parameters:
pipeline
- theChannelPipeline
which contains handler containing theSSLSession
.sslEvent
- the event indicating a SSL/TLS handshake completed.failureConsumer
- invoked if a failure is encountered.shouldReport
-true
if the handshake status should be reported toConnectionObserver.SecurityHandshakeObserver
.- Returns:
- The
SSLSession
ornull
if none can be found.
-
extractSslSession
@Nullable public static SSLSession extractSslSession(io.netty.channel.ChannelPipeline pipeline, io.netty.handler.ssl.SslHandshakeCompletionEvent sslEvent, Consumer<Throwable> failureConsumer) Extracts theSSLSession
from theChannelPipeline
if theSslHandshakeCompletionEvent
is successful or propagate the failure tofailureConsumer
.- Parameters:
pipeline
- theChannelPipeline
which contains handler containing theSSLSession
.sslEvent
- the event indicating a SSL/TLS handshake completed.failureConsumer
- invoked if a failure is encountered.- Returns:
- The
SSLSession
ornull
if none can be found.
-
extractSslSession(ChannelPipeline, SslHandshakeCompletionEvent, Consumer)
instead, reporting toConnectionObserver.SecurityHandshakeObserver
is handled automatically for allSslHandler
s initialized bySslClientChannelInitializer
orSslServerChannelInitializer
.