public class LoggingHttpProxy extends Object
Those persisted request/response pairs can be mocked by MockHttpServer.
Using the LoggingHttpProxy to persist request/responses and using them with the MockHttpServer is
especially useful for complex responses that are not that easy to mock by hand. It allows building a hermetic server.
The LoggingHttpProxy will return following HTTP return codes when things go wrong:
ForwardHttpRequestBuilder.
| Constructor and Description |
|---|
LoggingHttpProxy(int port,
Collection<ForwardHttpRequestBuilder> requestBuilders,
HttpRequestResponseLoggerFactory loggerFactory)
Create a new instance.
|
public LoggingHttpProxy(int port,
Collection<ForwardHttpRequestBuilder> requestBuilders,
HttpRequestResponseLoggerFactory loggerFactory)
port - Port at which proxy will be running.requestBuilders - Forward request builders. Should not be null and at least 1 should be specified.loggerFactory - Request/Response logger factory.. Should not be null.public void start()
throws IOException
Exception - In case starting fails.IOExceptionpublic void stop()
throws IOException
IOException - In case closing connection fails.Copyright © 2014. All Rights Reserved.