Error connecting to HTTPS

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Error connecting to HTTPS



   Am getting an error, when I tried connecting the https server with the
below code. I am not using any certificate to contact the server. Am I
really need a certificate to connect to the server. Because, I have been
told, that I can communicate to this particular server without certificate.

try {

     URI uri = new URI("",true);
     MySSLSocketFactory sslSocketFactory = new MySSLSocketFactory();

     Protocol myhttps = new Protocol("https", sslSocketFactory, 443);

     HttpClient httpclient = new HttpClient();

     httpclient.getHostConfiguration().setHost("", 443,

     String host = uri.getHost();
     int port = uri.getPort();

     AuthScope authScope = new AuthScope(host, port);

     Credentials credential = new UsernamePasswordCredentials

     GetMethod httpget = new GetMethod("/");

}catch(SSLException sslEX) {
     System.out.println("SSLException occured " + sslEX.getMessage());
}catch(HttpException ex) {
     System.out.println("HttpException occured " + ex.getMessage());
}catch (IOException ex) {
     System.out.println("IOException occured " + ex.getMessage());

org.apache.commons.httpclient.NoHttpResponseException: The server failed to respond

Thanks in Advance,

This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only.
If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at

To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]