given()。when()。header(“Authorization”,“Authorization Token”)。accept(ContentType.JSON).get(ServiceURL);

时间:2017-05-29 11:50:29

标签: rest-assured

我正在尝试在restassured测试方法中调用restful webservice,我收到以下错误。不确定是代码错误还是服务器错误。请帮帮我。

先谢谢。

java.net.ConnectException:拒绝连接:连接     at java.net.DualStackPlainSocketImpl.connect0(Native Method)     在java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)     在java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)     at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)     在java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)     在java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)     在java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)     在java.net.Socket.connect(Socket.java:589)     在org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117)     at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)     at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)     at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)     at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)     在org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)     在org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)     在org.apache.http.client.HttpClient $执行$ 0.call(未知来源)     在org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)     在org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110)     在org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130)

1 个答案:

答案 0 :(得分:0)

java.net.ConnectException: Connection refused: connect - 你的脱离主机有问题,检查ServiceURL是否真的正确。