Forward Actions - Java
When mocking a forward in Java use the org.mockserver.model.HttpForward class which specifies the details of each HTTP(S) forward with a fluent API, for example:
HttpForward httpForward =
forward()
.withHost("www.mock-server.com")
.withPort(80)
.withScheme(HttpForward.Scheme.HTTP);
The full specification of org.mockserver.model.HttpForward is as follows:
public class HttpForward {
/**
* The host or ip address to forward the request to i.e. "www.mock-server.com"
*
* @param host a hostname or ip address as a string
*/
public HttpForward withHost(String host);
/**
* The port to forward the request to i.e. 80. If not specified the port defaults to 80.
*
* @param port a port as an integer
*/
public HttpForward withPort(Integer port);
/**
* The scheme to use when forwarded the request, either HTTP or HTTPS. If not specified the scheme defaults to HTTP.
*
* @param scheme the scheme as a HttpForward.Scheme value
*/
public HttpForward withScheme(Scheme scheme);
}