If a page is https, you can obtain its content and HTTPS authentication information: 
 
Import java.net. malformedurlexception; 
 
Import java.net. url; 
 
Import java. Security. cert. Certificate; 
 
Import java. Io .*; 
 
Import javax.net. SSL. httpsurlconnection;
Import javax.net. SSL. sslpeerunverifiedexception;
 
Public class httpsclient {
 
/**
* @ Param ARGs
*/
Public static void main (string [] ARGs)
{
New httpsclient (). testit ();
}
 
Private void testit (){
 
String https_url = "https://www.aegpromotion.com/JackyGWIC2011/ SC /terms.asp ";
URL;
Try {
 
Url = new URL (https_url );
Httpsurlconnection con = (httpsurlconnection) URL. openconnection ();
 
// Dumpl all Cert info
Print_https_cert (CON );
 
// Dump all the content
Print_content (CON );
 
} Catch (malformedurlexception e ){
E. printstacktrace ();
} Catch (ioexception e ){
E. printstacktrace ();
}
 
}
 
Private void print_https_cert (httpsurlconnection con ){
 
If (con! = NULL ){
 
Try {
 
System. Out. println ("response code:" + con. getresponsecode ());
System. Out. println ("cipher suite:" + con. getciphersuite ());
System. Out. println ("\ n ");
 
Certificate [] certs = con. getservercertificates ();
For (certificate Cert: CERTS ){
System. Out. println ("Cert Type:" + cert. GetType ());
System. Out. println ("Cert hash code:" + cert. hashcode ());
System. Out. println ("Cert public key algorithm:" + cert. getpublickey (). getalgorithm ());
System. Out. println ("Cert public key format:" + cert. getpublickey (). getformat ());
System. Out. println ("\ n ");
}
 
} Catch (sslpeerunverifiedexception e ){
E. printstacktrace ();
} Catch (ioexception e ){
E. printstacktrace ();
}
 
}
 
}
 
Private void print_content (httpsurlconnection con ){
If (con! = NULL ){
 
Try {
 
System. Out. println ("****** content of the URL ********");
Bufferedreader BR =
New bufferedreader (
New inputstreamreader (con. getinputstream ()));
 
String input;
 
While (input = Br. Readline ())! = NULL ){
System. Out. println (input );
}
BR. Close ();
 
} Catch (ioexception e ){
E. printstacktrace ();
}
 
}
 
}