Class ParasoftHeaderInjectingProxy
java.lang.Object
com.parasoft.coverage.integration.proxy.ParasoftHeaderInjectingProxy
- All Implemented Interfaces:
AutoCloseable
HTTP proxy that injects the current Parasoft coverage
Baggage header
into proxied browser requests.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionStarts a proxy bound to "127.0.0.1" on an auto-assigned port and initializes the injected header from the current test thread.ParasoftHeaderInjectingProxy(String bindHost, int port, String baggageHeader) Starts a proxy on the requested host and port.ParasoftHeaderInjectingProxy(String bindHost, int port, AtomicReference<String> baggageHeader) Starts a proxy on the requested host and port with a shared baggage reference.ParasoftHeaderInjectingProxy(AtomicReference<String> baggageHeader) Starts a proxy bound to "127.0.0.1" on an auto-assigned port with a shared baggage reference. -
Method Summary
-
Field Details
-
BAGGAGE_HEADER_NAME
- See Also:
-
DEFAULT_BIND_HOST
- See Also:
-
-
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
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 astest-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 bindport- port to bind, or0for an auto-assigned portbaggageHeader- baggage value to inject, such astest-operator-id=userId+parallelId
-
ParasoftHeaderInjectingProxy
Starts a proxy on the requested host and port.- Parameters:
bindHost- host/interface to bindport- port to bind, or0for an auto-assigned portbaggageHeader- baggage value to inject, such astest-operator-id=userId+parallelId
-
-
Method Details
-
useCurrentTestBaggageHeader
public void useCurrentTestBaggageHeader()Refreshes the injected baggage value from the current test thread. -
setBaggageHeader
Sets the injected baggage value directly.- Parameters:
baggageHeader- baggage value to inject, ornullto stop injecting the header
-
getBaggageHeader
- Returns:
- the current baggage value that will be injected
-
getProxy
public org.littleshoot.proxy.HttpProxyServer getProxy()- Returns:
- the running LittleProxy server
-
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:
closein interfaceAutoCloseable
-