SocketTests ConnectAndDisposeClientConnection Method Delta Engine Documentation

Namespace: DeltaEngine.Networking.Tests.Tcp
Assembly: DeltaEngine.Networking.Tests (in DeltaEngine.Networking.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void ConnectAndDisposeClientConnection()
Examples

[Test, Category("Slow")]
public void ConnectAndDisposeClientConnection()
{
    echoServer.ClientConnected +=
        connection => Assert.AreEqual(1, echoServer.NumberOfConnectedClients);
    echoServer.ClientDisconnected +=
        connection => Assert.AreEqual(0, echoServer.NumberOfConnectedClients);
    var client = CreatedConnectedClient();
    bool clientDisconnected = false;
    client.Disconnected += () => clientDisconnected = true;
    WaitForServerResponse();
    Assert.AreEqual(ServerAddress + ":" + echoServer.ListenPort, client.TargetAddress);
    client.Dispose();
    Assert.IsTrue(clientDisconnected);
}
See Also