diff --git a/2.0.x/multi/multi__spring_cloud_contract_faq.html b/2.0.x/multi/multi__spring_cloud_contract_faq.html index b0e0c6ab63..a557f5b06d 100644 --- a/2.0.x/multi/multi__spring_cloud_contract_faq.html +++ b/2.0.x/multi/multi__spring_cloud_contract_faq.html @@ -644,13 +644,4 @@ matching response definition was picked.
To turn off this feature just bum to dump all mappings per artifact id. Also the port at which the given stub server was started will be attached.
Yes! With version 1.2.0 we’ve added such a possibility. It’s enough to call file(…) method in the
DSL and provide a path relative to where the contract lays.
-If you’re using YAML just use the bodyFromFile property.
When using an HTTP client (e.g. RestTemplate) and running several tests that share a Spring context, you might sometimes get the following exception:
java.net.SocketException: Unexpected end of file from server
Tom Akehurst, the creator of WireMock did the following analysis of this issue.
I looked at tcpdump while running the failing test.
HttpUrlConnectionis doing something weird - it’s creating a connection in a previous test case, which works fine, then the usualfin→fin acketc. ending handshake happens. But it seems it isn’t discarded, but reused after that. Because the server thinks (rightly) that the connection is closed, it just sends a RST packet. Calling the/__adminendpoint just happened to remove the dead connection from the pool. This also fixes the problem (which using the Java HTTP client): System.setProperty("http.keepAlive", "false");
There are the ways to solve this problem.
First, just use a different HTTP client for RestTemplate. Example for using Apache HTTP client:
pom.xml. -
<dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <scope>compile</scope> -</dependency>
-
this.restTemplate - .setRequestFactory(new HttpComponentsClientHttpRequestFactory());
Second option is to set the system property. You can set it either in code or pass it to your tests via a plugin.
static { - System.setProperty("http.keepAlive", "false"); -}