Class ParasoftHeaderInjectingProxy

java.lang.Object
com.parasoft.coverage.integration.proxy.ParasoftHeaderInjectingProxy
All Implemented Interfaces:
AutoCloseable

public final class ParasoftHeaderInjectingProxy extends Object implements AutoCloseable
HTTP proxy that injects the current Parasoft coverage Baggage header into proxied browser requests.
  • Field Details

  • Constructor Details

    • ParasoftHeaderInjectingProxy

      public ParasoftHeaderInjectingProxy()
      Starts a proxy bound to "127.0.0.1" on an auto-assigned port and initializes the injected header from the current test thread.
    • ParasoftHeaderInjectingProxy

      public ParasoftHeaderInjectingProxy(AtomicReference<String> baggageHeader)
      Starts a proxy bound to "127.0.0.1" on an auto-assigned port with a shared baggage reference.
      Parameters:
      baggageHeader - baggage value to inject, such as test-operator-id=userId+parallelId
    • ParasoftHeaderInjectingProxy

      public ParasoftHeaderInjectingProxy(String bindHost, int port, AtomicReference<String> baggageHeader)
      Starts a proxy on the requested host and port with a shared baggage reference.
      Parameters:
      bindHost - host/interface to bind
      port - port to bind, or 0 for an auto-assigned port
      baggageHeader - baggage value to inject, such as test-operator-id=userId+parallelId
    • ParasoftHeaderInjectingProxy

      public ParasoftHeaderInjectingProxy(String bindHost, int port, String baggageHeader)
      Starts a proxy on the requested host and port.
      Parameters:
      bindHost - host/interface to bind
      port - port to bind, or 0 for an auto-assigned port
      baggageHeader - baggage value to inject, such as test-operator-id=userId+parallelId
  • Method Details

    • useCurrentTestBaggageHeader

      public void useCurrentTestBaggageHeader()
      Refreshes the injected baggage value from the current test thread.
    • setBaggageHeader

      public void setBaggageHeader(String baggageHeader)
      Sets the injected baggage value directly.
      Parameters:
      baggageHeader - baggage value to inject, or null to stop injecting the header
    • getBaggageHeader

      public String getBaggageHeader()
      Returns:
      the current baggage value that will be injected
    • getProxy

      public org.littleshoot.proxy.HttpProxyServer getProxy()
      Returns:
      the running LittleProxy server
    • getHost

      public String getHost()
      Returns:
      the host this proxy is bound to
    • getPort

      public int getPort()
      Returns:
      the port this proxy is listening on
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable