java.net.ConnectException: Connection refused
I am forming the url - http://localhost:8085 while I go and connect to call the external webservice
I am using the below code to connect, please see the comments where it is failing
String url = Env.url + "/GET/WSResults"; // http://localhost:8085/GET/WSResults;
url = new URL(urlLink);// If I don't put http:// it fails here and gives malformed url exception
uri = new URI(url.getProtocol(), null, url.getHost(),url.getPort(), url.getPath(), url.getQuery(), null);
Client client = Client.create();
WebResource webResource = client.resource(uri); // this is failing as its unable to call the wiremock and trying to connect the external webservice at my localhost:8085, whereas it should replace this with the wiremock result.
ClientResponse response = webResource.get(ClientResponse.class);
result = response.getEntity(String.class);
Please let me know when I am using wireMockRule.stubFor("/GET/WSResults") what should be my url for the external service so that it matches with the stub and without any exception replace external webservice result with my wiremock stub result.