Class ProxySetupInfo

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

public class ProxySetupInfo extends Object
Single source of truth for the copy-paste proxy-setup information surfaced both in the startup log (see LifeCycle.startedServer) and the /mockserver/proxyConfiguration control-plane endpoint. It carries the active Certificate Authority certificate path, the HTTPS proxy URL, and the OS-specific environment-variable blocks a client needs to route TLS traffic through MockServer and trust its CA.

This is a pure value holder — constructing it has no logging or filesystem side effects. The CA file is materialised separately via KeyAndCertificateFactory.writeCertificateAuthorityToDisk() and its absolute path passed in.

Author:
jamesdbloom
  • Field Details

  • Constructor Details

    • ProxySetupInfo

      public ProxySetupInfo(String caCertificatePath, List<Integer> ports, Configuration configuration, String osName)
      Parameters:
      caCertificatePath - absolute path of the materialised active CA certificate PEM
      ports - the bound port(s); the first is used for the proxy URL
      configuration - the active configuration (used to determine the CA in effect)
      osName - the OS name (e.g. System.getProperty("os.name")) used to select between the Unix and PowerShell environment-variable blocks
  • Method Details

    • caCertificatePath

      public String caCertificatePath()
    • httpsProxyUrl

      public String httpsProxyUrl()
    • usingDefaultCa

      public boolean usingDefaultCa()
    • warning

      public String warning()
      Returns:
      the security warning text when the public baked-in CA is in effect, otherwise null
    • isWindows

      public boolean isWindows()
    • unixEnvBlock

      public String unixEnvBlock()
      Bash / zsh environment-variable exports for routing TLS traffic through MockServer and trusting its CA.
    • powershellEnvBlock

      public String powershellEnvBlock()
      PowerShell environment-variable assignments equivalent to unixEnvBlock().
    • copyPasteText

      public String copyPasteText()
      Assembles the full human-readable copy-paste block for the current OS, selecting the PowerShell block on Windows and the Unix block otherwise, and appending the security warning when the public baked-in CA is in effect.