public ResponseWrapper doRequest(String url, String content,
RequestMethod method) throws APIConnectionException, APIRequestException {
ResponseWrapper response = null;
for (int retryTimes = 0; ; retryTimes++) {
try {
response = _doRequest(url, content, method);
break;
} catch (SocketTimeoutException e) {
if (KEYWORDS_READ_TIMED_OUT.equals(e.getMessage())) {
throw new APIConnectionException(READ_TIMED_OUT_MESSAGE, e, true);
} else {
if (retryTimes >= _maxRetryTimes) {
throw new APIConnectionException(CONNECT_TIMED_OUT_MESSAGE, e, retryTimes);
} else {
LOG.debug("connect timed out - retry again - " + (retryTimes + 1));
}
}
}
}
return response;
}