Calculate AUTO_CONNECTION_ATTEMPTS from API_PROTOCOL_VERSIONS length
To reduce the number of changes required if this is expanded again in
future, and avoid forgetting to bump it, calculate instead of using a fixed
number. Tests will still need updating.