             }
             var (rdo, wro) : (NSInputStream?, NSOutputStream?)
             NSStream.getStreamsToHostWithName(self.req.URL!.host!, port: port, inputStream: &rdo, outputStream: &wro)
+
             (rd, wr) = (rdo!, wro!)
+            
             if req.URL!.scheme! == "wss" || req.URL!.scheme! == "https"  {
                 rd.setProperty(NSStreamSocketSecurityLevelNegotiatedSSL, forKey: NSStreamSocketSecurityLevelKey)
                 wr.setProperty(NSStreamSocketSecurityLevelNegotiatedSSL, forKey: NSStreamSocketSecurityLevelKey)

                            pthread_mutex_lock(&fireMutex)
                            if eventsAllowed {
                                self.fireEvent(events, delegate: delegate, event: .Closed, arg1: closeCode, arg2: closeReason, arg3: closeClean)
                                self.fireEvent(events, delegate: delegate, event: .End, arg1: closeCode, arg2: closeReason, arg3: closeClean, arg4: nil)
                            }
                            eventsAllowed = false
                            pthread_mutex_unlock(&fireMutex)

            pthread_mutex_unlock(&self.mutex)
        })
        
        
        var f : Frame?
        for ;; {
            pthread_mutex_lock(&self.mutex)
