Sync docs from master to gh-pages
This commit is contained in:
@@ -606,4 +606,13 @@ matching response definition was picked.</p><p>To turn off this feature just bum
|
||||
`StubRunnerExtension`to dump all mappings per artifact id. Also the port at which the given stub server
|
||||
was started will be attached.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_can_i_reference_text_from_file" href="#_can_i_reference_text_from_file"></a>3.8.3 Can I reference text from file?</h3></div></div></div><p>Yes! With version 1.2.0 we’ve added such a possibility. It’s enough to call <code class="literal">file(…​)</code> method in the
|
||||
DSL and provide a path relative to where the contract lays.
|
||||
If you’re using YAML just use the <code class="literal">bodyFromFile</code> property.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__spring_cloud_contract_verifier_introduction.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__spring_cloud_contract_verifier_setup.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2. Spring Cloud Contract Verifier Introduction </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-contract.html">Home</a></td><td width="40%" align="right" valign="top"> 4. Spring Cloud Contract Verifier Setup</td></tr></table></div></body></html>
|
||||
If you’re using YAML just use the <code class="literal">bodyFromFile</code> property.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_why_do_i_sometimes_get_socketexception" href="#_why_do_i_sometimes_get_socketexception"></a>3.8.4 Why do I sometimes get <code class="literal">SocketException</code></h3></div></div></div><p>When using an HTTP client (e.g. <code class="literal">RestTemplate</code>) and running several tests that share a Spring context, you might sometimes get the following exception:</p><pre class="screen">java.net.SocketException: Unexpected end of file from server</pre><p>Tom Akehurst, the creator of WireMock did the following analysis of this issue.</p><div class="blockquote"><blockquote class="blockquote"><p>I looked at tcpdump while running the failing test. <code class="literal">HttpUrlConnection</code> is doing something weird - it’s creating a connection in a previous test case, which works fine, then the usual <code class="literal">fin</code> → <code class="literal">fin ack</code> etc. 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 <code class="literal">/__admin</code> endpoint 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");</p></blockquote></div><p>There are the ways to solve this problem.</p><p>First, just use a different HTTP client for <code class="literal">RestTemplate</code>. Example for using Apache HTTP client:</p><p><b>pom.xml. </b>
|
||||
</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.apache.httpcomponents<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>httpclient<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><scope></span>compile<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></scope></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre><p>
|
||||
</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.restTemplate
|
||||
.setRequestFactory(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> HttpComponentsClientHttpRequestFactory());</pre><p>Second option is to set the system property. You can set it either in code or pass it to your tests via a plugin.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">static</span> {
|
||||
System.setProperty(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"http.keepAlive"</span>, <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"false"</span>);
|
||||
}</pre></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__spring_cloud_contract_verifier_introduction.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__spring_cloud_contract_verifier_setup.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2. Spring Cloud Contract Verifier Introduction </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-contract.html">Home</a></td><td width="40%" align="right" valign="top"> 4. Spring Cloud Contract Verifier Setup</td></tr></table></div></body></html>
|
||||
Reference in New Issue
Block a user