This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java Micro Edition and the fly likes HttpsConnection not establishing? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "HttpsConnection not establishing?" Watch "HttpsConnection not establishing?" New topic

HttpsConnection not establishing?

chetan dhewal
Ranch Hand

Joined: Nov 07, 2000
Posts: 61
hi all,

here is the code
try {

HttpsConnection con= (HttpsConnection)"");

DataInputStream di = con.openDataInputStream();

SecurityInfo si= con.getSecurityInfo();

System.out.println(si.getCipherSuite() +" "+ si.getProtocolName()+ " "+ si.getProtocolVersion());

byte[] arr=new byte[(int)con.getLength()];

System.out.print(new String(arr));

}catch(Exception e) {}

this code is giving me ClassCastException. The code is working fine if i establish plain HttpConnection. I am able to see the yahoo main page scripts. Is it that page doesnt support secure connections???
What can be the probable reason?

Chetan Dhewal<br />SCMAD,SCJP 1.2
Rashid Mayes
Ranch Hand

Joined: Jan 11, 2006
Posts: 160
It looks like you are missing an 's' or ':443' from your URL.

HTTP/S does not appear to be enabled on Yahoo's main page. When attempting a secure connection to Yahoo I am redirected to port 80.

Here is the wget output:

If you are using Yahoo to test your code, I would suggest using or

The full wget is below:

Rashid Mayes -
Have you checked out Aspose?
subject: HttpsConnection not establishing?
It's not a secret anymore!