Example #1
0
        public async Task T03_Disconnect_Before_Accept()
        {
            var server = AeSocketServer.Create(SocketServerLogger);
            await server.DisposeAsync();

            await Assert.ThrowsAsync <ObjectDisposedException> (async() => await server.AcceptObservable.LastOrDefaultAsync());
        }
Example #2
0
        public async Task T04_Disconnect_While_Accept()
        {
            var server     = AeSocketServer.Create(SocketServerLogger);
            var acceptTask = server.AcceptObservable.LastAsync().ToTask();
            await server.DisposeAsync();

            await Assert.ThrowsAsync <ObjectDisposedException>(async() => await acceptTask);
        }
Example #3
0
        public async Task T02_Accept_Success()
        {
            var server   = AeSocketServer.Create(SocketServerLogger);
            var endPoint = server.IPEndPoint;

            var acceptTask = server.AcceptObservable.FirstAsync().ToTask();

            var clientSocket = Utilities.CreateSocket();

            clientSocket.Connect(endPoint);

            var acceptedSocket = await acceptTask;

            Assert.True(clientSocket.Connected && acceptedSocket.Connected);

            clientSocket.Disconnect(false);
            await server.DisposeAsync();
        }
Example #4
0
        public void T01_Invalid_EndPoint()
        {
            var endPoint = new IPEndPoint(IPAddress.Parse("111.111.111.111"), 1111);

            Assert.Throws <SocketException>(() => AeSocketServer.Create(endPoint, SocketServerLogger));
        }