/* (non-Javadoc) * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() */ public void afterPropertiesSet() throws Exception { final HttpConnectionManager httpConnectionManager = httpClient.getHttpConnectionManager(); final HttpConnectionManagerParams params = httpConnectionManager.getParams(); params.setConnectionTimeout(connectionTimeout); params.setSoTimeout(readTimeout); params.setParameter( HttpMethodParams.RETRY_HANDLER, new HttpMethodRetryHandler() { public boolean retryMethod( final HttpMethod method, final IOException exception, int executionCount) { if (executionCount >= timesToRetry) { // Do not retry if over max retry count return false; } if (exception instanceof NoHttpResponseException) { // Retry if the server dropped connection on us return true; } if (exception instanceof SocketException) { // Retry if the server reset connection on us return true; } if (exception instanceof SocketTimeoutException) { // Retry if the read timed out return true; } if (!method.isRequestSent()) { // Retry if the request has not been sent fully or // if it's OK to retry methods that have been sent return true; } // otherwise do not retry return false; } }); }