public void RemoveSocketFromListTest() { manager.AddConnection(connection.Object, testStr); manager.RemoveConnection(connection.Object); Assert.DoesNotContain(testStr, manager.Connections.Keys); }
/// <summary> /// Called when you want to disconnect connection. /// </summary> /// <param name="connection">The connection.</param> /// <param name="status">The status.</param> /// <param name="statusString">The status string.</param> public virtual void OnDisconnected(Connection connection, WebSocketCloseStatus status = WebSocketCloseStatus.NormalClosure, string statusString = "Closed Peacefully") { if (connection?.Socket == null) { throw new NullReferenceException("connection or connection socket are null"); } WebSocketManager.RemoveConnection(connection); connection.Dispose(status, statusString); }