Gradle not releasing proxy settings after proxy is removed

On OS X set a proxy, then terminate proxy, ensure settings are unchecked in System Preferences -> Network -> Advanced -> Proxies, then run gradle build, build fails as gradle is trying to access the proxy URL which is no longer available. Specifially this happens when using Charles proxy app, with authentication to Artifactory. It is reproducable 99% of the time, killing the gradle daemon resolves the problem, all other applications have access to the internet when gradle is failing.

Sounds like we read proxy settings once instead of every time that we need them. Does this sound right @daz?

Looking at the code, I’m pretty sure we’re looking up the properties on every build. However, we’re looking them up from Java system properties, which are likely set for the life of the daemon.

Raised as https://issues.gradle.org/browse/GRADLE-3305