Skip to content

Instantly share code, notes, and snippets.

@charleehu
Created December 27, 2011 06:08
Show Gist options
  • Save charleehu/1522848 to your computer and use it in GitHub Desktop.
Save charleehu/1522848 to your computer and use it in GitHub Desktop.
autoproxy2pac file download
def conn = new URL("http://autoproxy2pac.appspot.com/pac/u/cafebabe.hu").openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.22.198.188", 8118)));
print("begin transfer...")
def count = 0;
conn.getInputStream().withStream {
def of = new File("c:\\cafebabe.hu").newOutputStream()
it.eachByte {
bt -> of.write(bt);count++;if(count%1024==0)print(".");
}
}
print("done. ${count} bytes")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment