Class NettyPipelineSslUtils
java.lang.Object
io.servicetalk.transport.netty.internal.NettyPipelineSslUtils
Utilities for
ChannelPipeline and SSL/TLS.-
Method Summary
Modifier and TypeMethodDescriptionstatic SSLSessionextractSslSession(io.netty.channel.ChannelPipeline pipeline, io.netty.handler.ssl.SslHandshakeCompletionEvent sslEvent, Consumer<Throwable> failureConsumer) Extracts theSSLSessionfrom theChannelPipelineif theSslHandshakeCompletionEventis successful or propagate the failure tofailureConsumer.static SSLSessionextractSslSession(SslConfig sslConfig, io.netty.channel.ChannelPipeline pipeline) Extracts theSSLSessionfrom theChannelPipelineif the handshake is already done.static SSLSessionextractSslSessionAndReport(io.netty.channel.ChannelPipeline pipeline, io.netty.handler.ssl.SslHandshakeCompletionEvent sslEvent, Consumer<Throwable> failureConsumer, boolean shouldReport) Deprecated.static SSLSessionextractSslSessionAndReport(SslConfig sslConfig, io.netty.channel.ChannelPipeline pipeline, ConnectionObserver connectionObserver) Deprecated.UseextractSslSession(SslConfig, ChannelPipeline)instead, reporting toConnectionObserver.SecurityHandshakeObserveris handled automatically for allSslHandlers initialized bySslClientChannelInitializerorSslServerChannelInitializerstatic booleanisSslEnabled(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 theChannelPipelineis configured for SSL/TLS.- Parameters:
pipeline- The pipeline to check.- Returns:
trueif 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.SecurityHandshakeObserveris handled automatically for allSslHandlers initialized bySslClientChannelInitializerorSslServerChannelInitializerExtracts theSSLSessionfrom theChannelPipelineif the handshake is already done and reports the result toConnectionObserver.SecurityHandshakeObserverif available. If it's done but failed, it rethrows the result.- Parameters:
sslConfig-SslConfigif SSL/TLS is expectedpipeline-ChannelPipelinewhich contains a handler containing theSSLSessionconnectionObserver-ConnectionObserverin case the handshake status should be reported- Returns:
- The
SSLSessionornullif none can be found - Throws:
IllegalStateException- ifSslHandlercan not be found in theChannelPipeline
-
extractSslSession
@Nullable public static SSLSession extractSslSession(@Nullable SslConfig sslConfig, io.netty.channel.ChannelPipeline pipeline) Extracts theSSLSessionfrom theChannelPipelineif the handshake is already done. If it's done but failed, it rethrows the result.- Parameters:
sslConfig-SslConfigif SSL/TLS is expectedpipeline-ChannelPipelinewhich contains a handler containing theSSLSession- Returns:
- The
SSLSessionornullif none can be found - Throws:
IllegalStateException- ifSslHandlercan 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.SecurityHandshakeObserveris handled automatically for allSslHandlers initialized bySslClientChannelInitializerorSslServerChannelInitializer.Extracts theSSLSessionfrom theChannelPipelineif theSslHandshakeCompletionEventis successful and reports the result toConnectionObserver.SecurityHandshakeObserverif available.- Parameters:
pipeline- theChannelPipelinewhich contains handler containing theSSLSession.sslEvent- the event indicating a SSL/TLS handshake completed.failureConsumer- invoked if a failure is encountered.shouldReport-trueif the handshake status should be reported toConnectionObserver.SecurityHandshakeObserver.- Returns:
- The
SSLSessionornullif 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 theSSLSessionfrom theChannelPipelineif theSslHandshakeCompletionEventis successful or propagate the failure tofailureConsumer.- Parameters:
pipeline- theChannelPipelinewhich contains handler containing theSSLSession.sslEvent- the event indicating a SSL/TLS handshake completed.failureConsumer- invoked if a failure is encountered.- Returns:
- The
SSLSessionornullif none can be found.
-
extractSslSession(ChannelPipeline, SslHandshakeCompletionEvent, Consumer)instead, reporting toConnectionObserver.SecurityHandshakeObserveris handled automatically for allSslHandlers initialized bySslClientChannelInitializerorSslServerChannelInitializer.