Class NettySslContextFactory

java.lang.Object
org.mockserver.socket.tls.NettySslContextFactory

public class NettySslContextFactory extends Object
Author:
jamesdbloom
  • Field Details

    • clientSslContextBuilderFunction

      public static Function<io.netty.handler.ssl.SslContextBuilder,io.netty.handler.ssl.SslContext> clientSslContextBuilderFunction
    • nettySslContextFactoryCustomizer

      public static Consumer<NettySslContextFactory> nettySslContextFactoryCustomizer
    • sslServerContextBuilderCustomizer

      public static UnaryOperator<io.netty.handler.ssl.SslContextBuilder> sslServerContextBuilderCustomizer
    • sslClientContextBuilderCustomizer

      public static UnaryOperator<io.netty.handler.ssl.SslContextBuilder> sslClientContextBuilderCustomizer
  • Constructor Details

    • NettySslContextFactory

      @Deprecated public NettySslContextFactory(MockServerLogger mockServerLogger)
      Deprecated.
      use constructor that specifies configuration explicitly
    • NettySslContextFactory

      public NettySslContextFactory(Configuration configuration, MockServerLogger mockServerLogger, boolean forServer)
  • Method Details

    • withClientSslContextBuilderFunction

      public NettySslContextFactory withClientSslContextBuilderFunction(Function<io.netty.handler.ssl.SslContextBuilder,io.netty.handler.ssl.SslContext> clientSslContextBuilderFunction)
    • createClientSslContext

      public io.netty.handler.ssl.SslContext createClientSslContext(boolean forwardProxyClient, boolean enableHttp2)
    • createClientSslContext

      public io.netty.handler.ssl.SslContext createClientSslContext(boolean forwardProxyClient, boolean enableHttp2, String host)
      Build (or return the cached) outbound client SslContext for connecting to an upstream.

      When host has a per-host client certificate/key mapping configured via forwardProxyClientCertificatesByHost, that host's cert/key pair is presented for outbound mTLS; otherwise the global forwardProxyPrivateKey / forwardProxyCertificateChain pair (or MockServer's own generated key/cert) is used, exactly as before. Contexts are cached: every host that resolves to the global pair shares one cached context (so the cache cannot grow unbounded across many upstream hosts), while each host with its own mapping gets its own context.

      Parameters:
      host - the upstream target host (may be null/blank — then only the global pair is ever used)
    • createServerSslContext

      public io.netty.handler.ssl.SslContext createServerSslContext()
    • trustCertificateChain

      public X509Certificate[] trustCertificateChain(String tlsMutualAuthenticationCertificateChain)
    • isForServer

      public boolean isForServer()