Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Groovy: Timeout due to proxy not being set (java.net.ConnectException)

Tags:

proxy

groovy

I want to use a Groovy script to access a webpage. However I'm behind a proxy.

Here's a test script that fails...

println "Google page is..."
println 'http://www.google.com'.toURL().text

Here's the output...

>groovy proxytester.groovy 
Google page is... 
Caught: java.net.ConnectException: Connection timed out: connect
   at checker.run(proxytester.groovy:2)

How do I set proxy server information in Groovy?

like image 474
Chris Avatar asked Dec 10 '22 00:12

Chris


1 Answers

Or, from inside Groovy itself:

System.properties << [ 'http.proxyHost':'proxyHost', 'http.proxyPort':'port' ]
like image 94
tim_yates Avatar answered Jan 22 '23 08:01

tim_yates