import java.applet.*;
import java.net.*;
+import javax.net.ssl.*;
import java.io.*;
class VNCProxyConnectSocketFactory implements SocketFactory {
+ SSLSocketFactory factory;
+
+ public VNCProxyConnectSocketFactory() {
+ try {
+ SSLContext c = SSLContext.getInstance("SSL");
+ c.init(null,
+ new TrustManager[] { new SIPBTrustManager() },
+ null);
+ factory =
+ (SSLSocketFactory)c.getSocketFactory();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
public Socket createSocket(String host, int port, Applet applet)
throws IOException {
System.out.println("VNCProxy CONNECT via proxy " + host +
" port " + port + " to vm " + vmname);
- VNCProxyConnectSocket s =
- new VNCProxyConnectSocket(host, port, vmname, authtoken);
+ SSLSocket ssls = (SSLSocket)factory.createSocket(host, port);
+ ssls.startHandshake();
+ VNCProxyConnectSocketWrapper s =
+ new VNCProxyConnectSocketWrapper(ssls, vmname, authtoken);
return (Socket)s;
}