Created
May 3, 2018 13:18
-
-
Save tom1299/133845d5194779f789852054fab774ef to your computer and use it in GitHub Desktop.
Open url in groovy using a http proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setProxies("http"); | |
setProxies("https"); | |
println 'http://www.google.com'.toURL().text | |
def setProxies(String protocol) { | |
String port = new URI(System.getenv("${protocol}_proxy")).port | |
String host = new URI(System.getenv("${protocol}_proxy")).host | |
System.setProperty("http.proxyHost", host); | |
System.setProperty("http.proxyPort", port); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment