You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Java Man <fb...@yahoo.com> on 2005/09/12 20:37:40 UTC

httpclient with SSL

Hi,
 
I am unable to get SSL connection to a third party server. I have done everything possible to install JSSE with J2SE 1.3, but I get -

javax.net.ssl.SSLHandshakeException: FATAL Alert:HANDSHAKE_FAILURE - The handshake handler was unable to negotiate an acceptable set of security parameters.

To test my SSL installation I used this code I got from Jakarta httpclient website - 

====================================================================

import java.io.BufferedReader;

import java.io.InputStreamReader;

import java.io.OutputStreamWriter;

import java.io.Writer;

import java.net.Socket;

import javax.net.ssl.SSLSocketFactory;

public class SSLTest {

public static final String TARGET_HTTPS_SERVER = "www.verisign.com"; 

public static final int TARGET_HTTPS_PORT = 443; 



public static void main(String[] args) throws Exception {



System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");

Socket socket = SSLSocketFactory.getDefault().

createSocket(TARGET_HTTPS_SERVER, TARGET_HTTPS_PORT);

try {

Writer out = new OutputStreamWriter(

socket.getOutputStream(), "ISO-8859-1");

out.write("GET / HTTP/1.1\r\n"); 

out.write("Host: " + TARGET_HTTPS_SERVER + ":" + 

TARGET_HTTPS_PORT + "\r\n"); 

out.write("Agent: SSL-TEST\r\n"); 

out.write("\r\n"); 

out.flush(); 

BufferedReader in = new BufferedReader(

new InputStreamReader(socket.getInputStream(), "ISO-8859-1"));

String line = null;

while ((line = in.readLine()) != null) {

System.out.println(line);

}

} finally {

socket.close(); 

}

}

}

====================================================================

 

Can anyone shed some light on this?

 

Thanks.


		
---------------------------------
Yahoo! for Good
 Click here to donate to the Hurricane Katrina relief effort.