Rest-assured requests not working

java, rest, rest-assured

Solution

Solved. Changed from `localhost` to `127.0.0.1` and it worked. It's kind of odd that both cURL/browser worked with localhost. Guess this might be a routing problem.

Problem

I am using Rest-Assured to test my Rest API. the webservice seems to be running ok, since running ``` curl -u "admin:admin" http://localhost:8888/users/ ``` i get my Users as json. then, when trying a simple request with Rest-Assured ``` RestAssured.authentication = basic("admin", "admin"); expect().statusCode(200).when().get("http://localhost:8888/users/"); ``` gives me the output ``` Exception in thread "main" org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:8888 refused at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:158) … ``` what can this be?

Original source