Configure for WireMockServer instead of port (#812)

When port = 0, WireMock will assign different ports for admin server and mock server. As a result, the original implementation will send admin requests to mock server, which is wrong behavior.

If this PR got merged, WireMock will directly add stubs instead of sending admin requests, which is correct behavior and also improves performance.
This commit is contained in:
杨博 (Yang Bo)
2018-12-12 02:47:52 +08:00
committed by Marcin Grzejszczak
parent a5fab08712
commit 3c3d3f7b19

View File

@@ -162,7 +162,7 @@ public class WireMockConfiguration implements SmartLifecycle {
@Override
public void start() {
this.server.start();
WireMock.configureFor("localhost", this.server.port());
WireMock.configureFor(new WireMock(this.server));
this.running = true;
if (log.isDebugEnabled()) {
log.debug("Started WireMock at port [" + this.server.port() + "]. It has ["
@@ -287,4 +287,4 @@ class WireMockProperties {
}
}
}