testing spring boot rest application with restAssured : <p>I've been struggling with this for some time now.
I'd like to use restAssured to test my SpringBoot REST application.</p>

<p>While it looks like container spins up properly, rest assured (and anything else seems to have problems reaching out to it.</p>

<p>All the time I'm getting Connection refused exception.</p>

<pre><code>java.net.ConnectException: Connection refused

at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
...
</code></pre>

<p>my test class:</p>

<pre><code>@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class SizesRestControllerIT {

    @Autowired
    private TestRestTemplate restTemplate;

    @Test
    public void test() {
        System.out.println(this.restTemplate.getForEntity("/clothes", List.class));
    }

    @Test
    public void test2() throws InterruptedException {
        given().basePath("/clothes").when().get("").then().statusCode(200);
    }

}
</code></pre>

<p>and now for the weird part, <code>test</code> passes and prints what it should, but <code>test2</code> is getting Connection refused exception.</p>

<p>Any ideas what is wrong with this setup?</p>
