0 Replies Latest reply on Jan 23, 2003 2:02 PM by bsette

    SSLSocket

    bsette

      Hi there,

      I am having difficulties in creating a SSLSocket with the code underneath. When I run it in the same JVM as Jboss,
      it returns a null SSLSocket. When I run it in another JVM it works fine.
      Any sugestions will be most helpfull.
      Thanks in advance.
      bsette


      import java.io.*;
      import java.net.*;
      import javax.net.ssl.*;
      import java.io.PrintWriter;

      import java.io.StringWriter;

      public SSLSocket creatSSLSocket() {

      StringWriter writer = new StringWriter();
      PrintWriter out = new PrintWriter(writer);

      public SSLSocket creatSSLSocket() {
      System.setProperty("javax.net.ssl.trustStore", ".keystore");

      try {

      SSLSocketFactory sf = (SSLSocketFactory) SSLSocketFactory.getDefault();
      SSLSocket s = (SSLSocket) sf.createSocket("localhost", 8444);
      return s;
      } catch (Exception ex)
      {
      ex.printStackTrace(out);
      }
      return null;
      }