我想使用Groovy脚本来访问网页.但是我支持代理.
这是一个失败的测试脚本......
println "Google page is..."
println 'http://www.google.com'.toURL().text
Run Code Online (Sandbox Code Playgroud)
这是输出......
>groovy proxytester.groovy
Google page is...
Caught: java.net.ConnectException: Connection timed out: connect
at checker.run(proxytester.groovy:2)
Run Code Online (Sandbox Code Playgroud)
如何在Groovy中设置代理服务器信息?
tim*_*tes 11
或者,从Groovy内部:
System.properties << [ 'http.proxyHost':'proxyHost', 'http.proxyPort':'port' ]
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3521 次 |
最近记录: |