public ClientReceiveActor(IActorRef actor, long repeat, TaskCompletionSource <bool> latch)
        {
            var received = 0L;
            var sent     = 0L;

            Receive <Messages.Msg>(m =>
            {
                received++;
                if (sent < repeat)
                {
                    actor.Tell(m);
                    sent++;
                }
                else if (received >= repeat)
                {
                    latch.SetResult(true);
                }
            });

            Receive <Messages.Run>(r =>
            {
                var msg = new Messages.Msg();
                for (var i = 0; i < Math.Min(1000, repeat); i++)
                {
                    actor.Tell(msg);
                    sent++;
                }
            });

            Receive <Messages.Started>(s => Sender.Tell(s));
        }
        protected override bool Receive(object message)
        {
            switch (message)
            {
            case Messages.Msg _:
                _received++;
                if (_sent < _repeat)
                {
                    _actor.Tell(message);
                    _sent++;
                }
                else if (_received >= _repeat)
                {
                    //       Console.WriteLine("done {0}", Self.Path);
                    _latch.SetResult(true);
                }
                return(true);

            case Messages.Run _:
                var msg = new Messages.Msg();
                for (var i = 0; i < Math.Min(1000, _repeat); i++)
                {
                    _actor.Tell(msg);
                    _sent++;
                }
                return(true);

            case Messages.Started _:
                Sender.Tell(message);
                return(true);
            }

            return(false);
        }