/** * Checks whether an attempt to reconnect should be executed. This method also handles the * counter variables to keep track of the state. * * @return If we should execute reconnect. */ private boolean shouldReconnect() { noConnectionCount++; boolean shouldReconnect = noConnectionCount >= nextReconnectAt; if (shouldReconnect) { noConnectionCount = 0; increaseNextReconnectAt(); } return shouldReconnect; }