/// <summary> /// Creates a new connection for the tunnel. /// </summary> /// <param name="session">The session that will own the connection.</param> /// <param name="connectionId"></param> /// <returns> /// The <see cref="T:BlueBoxMoon.LocalSubway.Connection" /> that can now be added to the tunnel. /// </returns> public override async Task <Connection> CreateConnectionAsync(ClientSession session, Guid connectionId) { var connection = new EchoConnection(session, connectionId, Id); await connection.StartAsync(); return(connection); }
static void Main(string[] args) { //Enable or disable log: EchoConnection.LogReceive = true; //Start the Queues: EchoServer.ServerQueue.Start(); EchoConnection.ClientQueue.Start(); //Address: IPEndPoint address = new IPEndPoint(IPAddress.Loopback, 5588); //Start listening EchoServer server = new EchoServer(); server.Bind(address); //Start 10 accept operations: for (int i = 0; i < 10; i++) { server.Accept(); } //Start client when S is hit. Console.WriteLine("HIT S to start client!"); while (Console.ReadKey(true).Key != ConsoleKey.S) { continue; } //Connect 1000 connections: for (int i = 0; i < 1000; i++) { EchoConnection connection = new EchoConnection(); connection.Connect(address); } //Close app when Q is hit Console.WriteLine("HIT Q to close app."); while (Console.ReadKey(true).Key != ConsoleKey.Q) { continue; } }