2002/05/05 08:37:32
[org.ibex.core.git] / src / org / xwt / TinySSL.java
index 41e83a1..e3f90ab 100644 (file)
@@ -151,12 +151,17 @@ public class TinySSL extends Socket {
     public InputStream getInputStream() { return is; }
     public OutputStream getOutputStream() { return os; }
 
-    public TinySSL(String host, int port) throws IOException {
+    public TinySSL(String host, int port) throws IOException { this(host, port, true); }
+    public TinySSL(String host, int port, boolean negotiateImmediately) throws IOException {
         super(host, port);
         hostname = host;
+        if (negotiateImmediately) negotiate();
+    }
+
+    /** negotiates the SSL connection */
+    public void negotiate() throws IOException {
         os = new SSLOutputStream(super.getOutputStream());
         is = new SSLInputStream(super.getInputStream());
-            
         os.writeClientHello();
         is.readServerHandshakes();
         os.sendClientHandshakes();