MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding).
I am using 5.11.1 version and observed the same issue. I would like to know why this happens and what could be the fix.
`
public class MockServerExample {
/* Set up service endpoint */
public static String HOST = "127.0.0.1";
public static int PORT = 1080;
public static void start() {
startClientAndServer(PORT);
createExpectations();
}
private static void createExpectation() {
new MockServerClient(HOST, PORT)
.when(
request()
.withPath("/path1/ping")
)
.forward(
forward()
.withHost("127.0.0.1")
.withPort(9000)
);
new MockServerClient(HOST, PORT)
.when(
request()
.withPath("/path2")
)
.forward(
forwardOverriddenRequest(
request()
.withPath("/path2")
.withSocketAddress("127.0.0.1", 60000, SocketAddress.Scheme.HTTP)
)
);`
It is basically testing request forwarding. Upon receiving the request, it forwards to localhost:60000 with same path. In the @beforeClass, it calls start().
The error I got is:
DEBUG 19:36:31.880 [main] o.a.http.impl.execchain.RetryExec: The target server failed to respond ! org.apache.http.NoHttpResponseException: The target server failed to respond ! at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141) ~[httpclient-4.5.9.jar:4.5.9] ! at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) ~[httpclient-4.5.9.jar:4.5.9] ! at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) ~[httpcore-4.4.11.jar:4.4.11] ...
I am using 5.11.1 version and observed the same issue. I would like to know why this happens and what could be the fix.
` public class MockServerExample {
It is basically testing request forwarding. Upon receiving the request, it forwards to localhost:60000 with same path. In the @beforeClass, it calls start().
The error I got is: DEBUG 19:36:31.880 [main] o.a.http.impl.execchain.RetryExec: The target server failed to respond ! org.apache.http.NoHttpResponseException: The target server failed to respond ! at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141) ~[httpclient-4.5.9.jar:4.5.9] ! at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) ~[httpclient-4.5.9.jar:4.5.9] ! at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) ~[httpcore-4.4.11.jar:4.4.11] ...