2012-05-08 48 views
5

我正在使用Rest-Assured来测试我的Rest API。 web服务似乎是确定运行,运行以来不能正常工作的请求

curl -u "admin:admin" http://localhost:8888/users/ 

让我的用户为JSON。

然后,尝试与休息,放心

RestAssured.authentication = basic("admin", "admin"); 

    expect().statusCode(200).when().get("http://localhost:8888/users/"); 

一个简单的请求时,给我的输出

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) 
… 

可这有什么呢?

回答

2

已解决。从localhost更改为127.0.0.1,它工作。这两个cURL /浏览器与localhost一起工作有点奇怪。猜猜这可能是一个路由问题。