Connect to the network using proxy
@ Test public void t13 () {string charset = "UTF-8"; string proxyhost = "proxy address"; int proxyport = 1234; // proxy port string proxyursername = "Login Proxy Server Username"; string proxypassword = "Login proxy server password"; string urlstr = "http://www.baidu.com"; string ret = ""; inputstream is = NULL; try {proxy = new proxy (proxy. type. HTTP, new inetsocketaddress (proxyhost, proxyport); Url url = new URL (urlstr); httpurlc Onnection connection = (httpurlconnection) URL. openconnection (proxy); base64encoder encoder = new base64encoder (); string authorization = new string (encoder. encode (new string (proxyursername + ":" + proxypassword ). getbytes (); connection. setrequestproperty ("proxy-Authorization", "Basic" + authorization); connection. setdoinput (true); connection. setrequestmethod ("get"); connection. connect (); is = Co Nnection. getinputstream (); stringbuffer sb = new stringbuffer (); int RL =-1; byte [] Buf = new byte [1024]; while (RL = is. read (BUF ))! =-1) {sb. append (new string (BUF, 0, rl, charset);} ret = sb. tostring (); connection. disconnect ();} catch (malformedurlexception e) {e. printstacktrace ();} catch (ioexception e) {e. printstacktrace ();} finally {If (is! = NULL) {try {is. Close () ;}catch (ioexception e) {e. printstacktrace () ;}} system. Out. println (RET );}
How to bring up the IE proxy box when connecting to the network so that the user does not know how to implement the input?
I do not know how to obtain the IE proxy.
Access the network through proxy