public async Task T03_Disconnect_Before_Accept() { var server = AeSocketServer.Create(SocketServerLogger); await server.DisposeAsync(); await Assert.ThrowsAsync <ObjectDisposedException> (async() => await server.AcceptObservable.LastOrDefaultAsync()); }
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); }
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(); }
public void T01_Invalid_EndPoint() { var endPoint = new IPEndPoint(IPAddress.Parse("111.111.111.111"), 1111); Assert.Throws <SocketException>(() => AeSocketServer.Create(endPoint, SocketServerLogger)); }