public ShortTimeoutLongTask(TestLatch latch, AtomicCounter counter) { StartWith( Loop( ReceiveAny(s => s.Equals("RUN"), After( Timeout(TimeSpan.FromMilliseconds(100), Delay(5.Seconds(), Execute(_ => counter.GetAndIncrement())), Execute(_ => { counter.GetAndDecrement(); Sender.Tell("TIMEOUT"); })), Execute(_ => latch.CountDown())))), null); }