Exemplo n.º 1
0
    async Task DoTransactions(FakeSocketProvider.FakeSocket socket, FakeSocketProvider.FakeSocket client)
    {
        var content = await socket.ReceiveAsync(client);

        var message = _listener == null ? content : _listener?.ProcessMessage(content);

        await socket.SendAsync(client, message);
    }
Exemplo n.º 2
0
    async Task Listen()
    {
        while (true)
        {
            var socket = new FakeSocketProvider.FakeSocket(_fakeSocketProvider, "Server");
            var client = await socket.AcceptAsync();

            Task.Run(() => DoTransactions(socket, client));
        }
    }
Exemplo n.º 3
0
 public async Task Connect(FakeSocketProvider provider)
 {
     _socket = new FakeSocketProvider.FakeSocket(provider, "Client"); // Name is set for test purposes
     await _socket.ConnectAsync();
 }