List of usage examples for org.apache.commons.httpclient ConnectTimeoutException ConnectTimeoutException
public ConnectTimeoutException()
From source file:com.basho.riak.client.http.util.logging.LogNoHttpResponseRetryHandlerTest.java
/** * Test method for// w w w . j a v a 2 s .c o m * {@link com.basho.riak.client.http.util.logging.LogNoHttpResponseRetryHandler#retryMethod(org.apache.commons.httpclient.HttpMethod, java.io.IOException, int)} * . */ @Test public void retry() { final HttpMethod method = new GetMethod(); final IOException noHttpResponseException = new NoHttpResponseException(); final IOException otherException = new ConnectTimeoutException(); final int executionCount = 0; // when retry is called with a NoHtpResponseException // dump should be called on the appender LogNoHttpResponseRetryHandler handler = new LogNoHttpResponseRetryHandler(MOCK_APPENDER_NAME); boolean expected = new DefaultHttpMethodRetryHandler().retryMethod(method, noHttpResponseException, executionCount); boolean actual = handler.retryMethod(method, noHttpResponseException, executionCount); verify(mockAppender, times(1)).dump(); assertEquals(expected, actual); expected = new DefaultHttpMethodRetryHandler().retryMethod(method, otherException, executionCount); actual = handler.retryMethod(method, otherException, executionCount); // dump must not have been called again! verify(mockAppender, times(1)).dump(); // but the behaviour of the handler should still match the default assertEquals(expected, actual); }