// Access the Internet through proxy https
Public class test99999 extends thread {
Public static void main (string [] ARGs) throws exception {
// Set proxy
String proxy = "openproxy.w.wei.com ";
Int Port = 8080;
System. setproperty ("proxytype", "4 ");
System. setproperty ("proxyport", integer. tostring (port ));
System. setproperty ("proxyhost", proxy );
System. setproperty ("proxyset", "true ");
String url = "https://www.smics.com /";
Sslcontext SC = sslcontext. getinstance ("SSL ");
// Specify the trust https
SC. INIT (null, new trustmanager [] {New trustanytrustmanager ()}, new java. Security. securerandom ());
URL console = new URL (URL );
Httpsurlconnection conn = (httpsurlconnection) console. openconnection ();
Conn. setsslsocketfactory (SC. getsocketfactory ());
Conn. sethostnameverifier (New trustanyhostnameverifier ());
Conn. Connect ();
System. Out. println ("returned result:" + conn. getresponsemessage ());
Inputstream is = conn. getinputstream ();
Bufferedreader reader = new bufferedreader (New inputstreamreader (is ));
String curline = "";
While (curline = reader. Readline ())! = NULL ){
System. Out. println (curline );
}
Is. Close ();
}
Private Static class trustanytrustmanager implements x509trustmanager {
Public void checkclienttrusted (x509certificate [] Chain, string authtype) throws certificateexception {
}
Public void checkservertrusted (x509certificate [] Chain, string authtype) throws certificateexception {
}
Public x509certificate [] getacceptedissuers (){
Return new x509certificate [] {};
}
}
Private Static class trustanyhostnameverifier implements hostnameverifier {
Public Boolean verify (string hostname, sslsession session ){
Return true;
}
}