                 if(proxy_mode) {
 
                 } else {
-                    /* Listen for incoming RTMFP connections. */
-                    var s_r:RTMFPSocket = new RTMFPSocket(circon);
-                    s_r.addEventListener(Event.CONNECT, rtmfp_connect_event);
-                    s_r.listen();
-
+                    puts("Setting up listening RTMFPConnectionPair");
+                    var rcp:RTMFPConnectionPair = new RTMFPConnectionPair(circon, tor_addr, output_text);
+                    rcp.addEventListener(Event.CONNECT, rcp_connect_event);
+                    rcp.addEventListener(Event.CLOSE, rcp_close_event);
+                    rcp.listen();
+
+                    puts("Registering with facilitator");
                     /* Register ID with facilitator. */
                     register_id(circon.nearID, fac_addr);
                 }

    private var send_stream:NetStream;
    private var recv_stream:NetStream;

    public function RTMFPSocket(circon:NetConnection)
    {
        this.circon = circon;
    }

    public function listen():void

        return true;
    }

    public function readBytes(bytes:ByteArray):void
    {
        recv_stream.client.bytes.readBytes(bytes);
    }

    public function writeBytes(bytes:ByteArray):void
    {
        send_stream.send("dataAvailable", bytes);
    }

    public function close():void
    {
        puts("RTMFPSocket: closing...");
        send_stream.close();
        recv_stream.close();
        connected = false;
    }
}

dynamic class RTMFPSocketClient extends EventDispatcher
