   private static var CLOSING:int = 2;
   private static var CLOSED:int = 3;
   
-  private var socket:RFC2817Socket;
+  //private var rawSocket:RFC2817Socket;
+  private var rawSocket:Socket;
+  private var tlsSocket:TLSSocket;
+  private var tlsConfig:TLSConfig;
+  private var socket:Socket;
   private var main:WebSocketMain;
   private var url:String;
   private var scheme:String;

  
  private function onSocketConnect(event:Event):void {
    main.log("connected");
    var hostValue:String = host + (port == 80 ? "" : ":" + port);
    var cookie:String = "";
    if (main.getCallerHost() == host) {

    // "Header1: xxx\r\nHeader2: yyyy\r\n"
    this.headers = headers;
    
    /*
    socket = new RFC2817Socket();
            
    // if no proxy information is supplied, it acts like a normal Socket
