int statusCode = statusLine.getStatusCode();
if (statusCode == HttpConstants.Codes.SUCCESS) {
logger.debug("{} Connection successfully established", name);
statsReporter.incrNum200s();
connectionEstablished.set(true);
addEvent(new HttpResponseEvent(EventType.CONNECTED, statusLine));
reconnectionManager.resetCounts();
return true;
}
logger.warn(name + " Error connecting w/ status code - {}, reason - {}", statusCode, statusLine.getReasonPhrase());
statsReporter.incrNumConnectionFailures();
addEvent(new HttpResponseEvent(EventType.HTTP_ERROR, statusLine));
if (HttpConstants.FATAL_CODES.contains(statusCode)) {
setExitStatus(new Event(EventType.STOPPED_BY_ERROR, "Fatal error code: " + statusCode));
} else if (statusCode < 500 && statusCode >= 400) {
statsReporter.incrNum400s();
// we will retry these a set number of times, then fail