[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-ssl] HttpsURLConnection

Hi, all,

Currently I am writing a HTTPs client to connect to a servlet which resides on a SSL-enabled web server.  I included all the
required JAR files and set up "java.protocol.handler.pkgs" to be "iaik.protocol", and what I am doing is:

    HttpsURLConnection con = (HttpsURLConnection) servlet.openConnection();

    PrintWriter http_out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(con.getOutputStream())));

     http_out.println(post_str);  /*post_str is a string*/

     BufferedReader http_reponse = new BufferedReader(new InputStreamReader(con.getInputStream()));

     String str;
     StringBuffer sb = new StringBuffer();
     while((str=http_reponse.readLine()) != null) {


     reply_str = sb.toString();

However, it seems that the client aborts at the line: "while((str=http_reponse.readLine()) != null)",  and the exception is:

java.io.EOFException: Connection closed by remote host.
        at iaik.security.ssl.Utils.a(Compiled Code)
        at iaik.security.ssl.p.a(Unknown Source)
        at iaik.security.ssl.p.g(Unknown Source)
        at iaik.security.ssl.l.b(Unknown Source)
        at iaik.security.ssl.l.a(Unknown Source)
        at iaik.security.ssl.l.read(Unknown Source)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:227)
        at java.io.BufferedInputStream.read(Compiled Code)
        at java.io.FilterInputStream.read(FilterInputStream.java:97)
        at java.io.InputStreamReader.fill(Compiled Code)
        at java.io.InputStreamReader.read(InputStreamReader.java:239)
        at java.io.BufferedReader.fill(Compiled Code)
        at java.io.BufferedReader.readLine(Compiled Code)
        at java.io.BufferedReader.readLine(Compiled Code)

I checked the servlet, it receives the posted string, and already sends out the reply string, but somehow, the client cannot receive
it because of the connection is closed strangely?

Any help is needed at once!!!  Thanks a lot


Mailinglist-archive at http://jcewww.iaik.at/mailarchive/iaik-ssl/sslthreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content: UNSUBSCRIBE iaik-ssl