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

AW: [iaik-ssl]cu|| java.io.EOFException Connection closed by remote host

maybe you have put more jar files into the classpath than required and this is causing
troubles (so, for instance, you do not require both iaik_jce_full.jar and iaik_rc.jar since
RC* already is included in iaik_jce_full.jar).
Also you may not try to POST to https://jcewww.iaik.at/, you only may use GET.
To get more information about the handshake course you may enable output
of debug information:
Please note that you will get a "java.io.EOFException: Connection closed by remote host"
also when connecting successfully to https://jcewww.iaik.at/ since we use MIIS which does
not correctly shutdown the SSL/TLS layer before closing the connection on the TCP level
(see http://jcewww.iaik.tu-graz.ac.at/products/isasilk/documentation/interoperability/index.php
for more information).
Dieter Bratko

-----Ursprüngliche Nachricht-----
Von: iaik-ssl-owner@iaik.at [mailto:iaik-ssl-owner@iaik.at]Im Auftrag von Hernán Di Chello
Gesendet: Freitag, 03. Mai 2002 14:24
An: iaik-ssl@iaik.at
Betreff: [iaik-ssl]cu|| java.io.EOFException Connection closed by remote host

Hi everybody,
    I´m having the following problem. I´v downloaded and installed the following files (for evaluation):
1. IAIKJCE30ev.exe
2. iaik_rc.jar
3. iaik_jce_full.jar
4. isasilk304ev.zip
When I tried to use the HttpsURLConnection, I have the following error:
"java.io.EOFException: Connection closed by remote host."
This happens when I try to do the following: "InputStream is = con.getInputStream();"
Anybody knows how to solve this problem?
thanks in advanced
Hernan Di Chello 
The source code is below
import java.io.*;
import java.net.*;
import java.util.*;
import iaik.security.ssl.*;
import iaik.protocol.https.*;
public class ssltest {
  public static void main(String args[]) throws Exception {
   Properties prop = System.getProperties();
    // register the https URL handler
    System.getProperties().put("java.protocol.handler.pkgs", "iaik.protocol");
    String urlString= "https://jcewww.iaik.at/";
    // the connection is automatically established through proxies
    // if the properties have been set, see iaik.security.ssl.Utils.proxyConnect()
    URL url = new URL(urlString);
 System.out.println("Connecting to " + url + "...");
   HttpsURLConnection con = (HttpsURLConnection)url.openConnection();
   SSLContext context = new SSLClientContext();
   // make whatever settings we want in the context
    context.setAllowedProtocolVersions(SSLContext.VERSION_SSL20, SSLContext.VERSION_TLS10);
 OutputStream out = con.getOutputStream();

   // getInputStream()/getOutputStream() establishes the connection and
   // starts the SSL handshake
   InputStream is = con.getInputStream();
   BufferedReader in = Utils.getASCIIReader(is);
 char b[] = new char[2048];
 int nch=0;
   System.out.println("Secure connection established.");
   // read SSL properties from the socket
//   System.out.println("Connected using: " + con.getSSLSocket().getActiveCipherSuite());
   // everything else is standard HTTP URL stuff
   System.out.println("ResponseCode: "+con.getResponseCode());
   System.out.println("ResponseMessage: "+con.getResponseMessage());
   System.out.println("ContentEncoding: "+con.getContentEncoding());
   System.out.println("ContentLength: "+con.getContentLength());
   System.out.println("ContentType: "+con.getContentType());
   System.out.println("Date: "+con.getDate());
   System.out.println("Server: "+con.getHeaderField("Server"));
   while((nch=in.read(b,0,b.length)) != -1)
    System.out.print(new String(b));
  }catch(Exception e)
   FileOutputStream fs = new FileOutputStream(new File("/ERROR_IAIK.TXT"));
   throw new Exception(e.getMessage());