Can anybody help. I get this error while running following program. I am using JDk1.4
package sslclient;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import javax.net.ssl.*;
import java.io.*;
import java.net.*;
import javax.security.cert.*;
// A simple text-based browser
public class voiceBrowser {
String urlString;
// You must supply the URL to be browsed
public static void main(String[] args) throws Exception {
voiceBrowser vBrowser = new voiceBrowser();
vBrowser.run();
}
// Construct voice browser object
public voiceBrowser() {
}
// Get the URL
public void run() throws Exception {
String thisLine;
// Get a SocketFactory object for creating SSL sockets
SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
// Create a secure socket connected to the HTTPS port (port 443) of a server
SSLSocket sslsock = (SSLSocket) factory.createSocket("113.128.2.131", 443);
// Get the certificate presented by the web server. This may throw an
// exception if the server didn't supply a certificate. Look at the
// issuer of the certificate and decide if it is trusted.
SSLSession session = sslsock.getSession();
//Certificate cert = (Certificate)session.getPeerCertificateChain()[0];
//String issuer = cert.getIssuerDN().getName();
// Assuming we trust the certificate, we now use the socket just like a normal
// java.net.Socket object. So send a HTTP request and read the response
PrintWriter out = new PrintWriter(sslsock.getOutputStream());
out.print("GET " + "/homes/hmehta/web.xml" + " HTTP/1.0\r\n\r\n");
out.flush();
// Next, read the server's response and print it to the console.
BufferedReader in =
new BufferedReader(new InputStreamReader(sslsock.getInputStream()));
String line;
while((line = in.readLine()) != null) System.out.println(line);
// Finally, close the socket.
sslsock.close();
}
}