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();