Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ezhov-da/ede3486d50eb30319c05eb1de105e17d to your computer and use it in GitHub Desktop.
Save ezhov-da/ede3486d50eb30319c05eb1de105e17d to your computer and use it in GitHub Desktop.
groovy подключение через прокси (proxy)
http://groovy-almanac.org/opening-an-url-with-a-proxy/
[code:]groovy[:code] System.properties.putAll( ["http.proxyHost":"proxy-host", "http.proxyPort":"proxy-port"] )
def url = 'http://www.google.com/images/logo.gif'
def file = new FileOutputStream(address.tokenize("/")[-1])
def out = new BufferedOutputStream(file)
out << new URL(address).openStream()
out.close()
System.properties.putAll([
"https.proxyUser": "11_da",
"https.proxyPassword": "123",
"https.proxyHost": "mwg",
"https.proxyPort": "11"
])
[/code]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment