         return true;
     }
 
+    private function circon_netstatus_event(event:NetStatusEvent):void
+    {
+        switch (event.info.code) {
+        case "NetStream.Connect.Closed" :
+            puts("RTMFPSocket: NetStream connection was closed");
+
+            if(connected)
+            {
+                send_stream.close();
+                recv_stream.close();
+                connected = false;
+                dispatchEvent(new Event(Event.CLOSE));
+            }
+
+            break;
+        }
+    }
+
+
     public function readBytes(bytes:ByteArray):void
     {
         recv_stream.client.bytes.readBytes(bytes);

        {
            switch (event.info.code) {
            case "NetConnection.Connect.Success" :
                puts("circon_netstatus_event: NetConnection.Connect.Success");
                puts("Got id " + circon.nearID + ".");
                clearInterval(circon_timeo_id);
                


    private function rtmfp_connect_event(e:Event):void
    {
        puts("RTMFPConnectionPair: RTMFPSocket side connected!");
        puts("RTMFPConnectionPair: setting up tor side connection...");

        /* Setup tor connection linked to RTMFPSocket. */
        s_t = new Socket();
