@Test public void testRetriesRequests() throws IOException { final int retries = 3; HttpFetchConfiguration settings = new HttpFetchConfigurationBuilder().setRetries(retries).build(); HttpFetcher httpFetcher = new HttpFetcher(settings); stubFor(get(urlEqualTo("/1")).willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); stubFor(get(urlEqualTo("/2")).willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); stubFor(get(urlEqualTo("/3")).willReturn(aResponse().withStatus(HttpStatus.SC_OK).withBody("body"))); HttpEntity responseEntity = httpFetcher.fetch("http: String bodyContent = readStream(responseEntity.getContent()); EntityUtils.consume(responseEntity); assertThat(bodyContent, equalTo("body")); }
public HttpEntity fetch(String url, String acceptHeader) throws HttpFetchException { return fetch(url, acceptHeader, PLAIN_URI_PROVIDER, PLAIN_GET_REQUEST_PROVIDER); }
HttpFetcher { public HttpEntity fetch(String url, String acceptHeader) throws HttpFetchException { return fetch(url, acceptHeader, PLAIN_URI_PROVIDER, PLAIN_GET_REQUEST_PROVIDER); } }
HttpFetcher { public HttpEntity fetch(String url, String acceptHeader) throws HttpFetchException { return fetch(url, acceptHeader, PLAIN_URI_PROVIDER, PLAIN_GET_REQUEST_PROVIDER); } HttpFetcher(CookieStore cookieStore,
	                   HttpClient client, HttpFetchConfiguration settings);  HttpFetcher(HttpFetchConfiguration settings); }
HttpFetcher { public HttpEntity fetch(String url, String acceptHeader) throws HttpFetchException { return fetch(url, acceptHeader, PLAIN_URI_PROVIDER, PLAIN_GET_REQUEST_PROVIDER); } HttpFetcher(CookieStore cookieStore,
	                   HttpClient client, HttpFetchConfiguration settings);  HttpFetcher(HttpFetchConfiguration settings); void ensureCookie(); void clearCookie(); HttpEntity fetch(String url, String acceptHeader); HttpEntity fetch(String identifier,
	                        String acceptHeader,
	                        UriProvider uriProvider, RequestProvider requestProvider); CookieStore getCookieStore(); HttpClient getClient(); HttpFetchConfiguration getConfiguration(); }
HttpFetcher { public HttpEntity fetch(String url, String acceptHeader) throws HttpFetchException { return fetch(url, acceptHeader, PLAIN_URI_PROVIDER, PLAIN_GET_REQUEST_PROVIDER); } HttpFetcher(CookieStore cookieStore,
	                   HttpClient client, HttpFetchConfiguration settings);  HttpFetcher(HttpFetchConfiguration settings); void ensureCookie(); void clearCookie(); HttpEntity fetch(String url, String acceptHeader); HttpEntity fetch(String identifier,
	                        String acceptHeader,
	                        UriProvider uriProvider, RequestProvider requestProvider); CookieStore getCookieStore(); HttpClient getClient(); HttpFetchConfiguration getConfiguration();  }