Fix flaky tests caused by accidental cache hit (#3025) gradle/gradle-private#948 When two tests happen to be assigned the same port number, the cache is hit by accident. This result in different control flows and flaky tests.
Fix concurrency bug in `HttpClientHelper` The HTTP context should not be shared by several requests, or it just breaks when requests are done in parallel. This explains the failures seen with `NTLM` authentication, but not only: there were more failures with `BASIC` authentication too (and probably random other failures).
This commit changes the `HttpContext` so that we create a new one per request, in case we don't use authentication, and if we do, then requests cannot be done in parallel (until we find a proper fix). This removes the special case in `HttpAuthenticationDependencyResolutionIntegrationTest`.