private void WithSubstreamsSupport(int splitWhen = 3, int elementCount = 6, SubstreamCancelStrategy substreamCancelStrategy = SubstreamCancelStrategy.Drain, Action <TestSubscriber.ManualProbe <Source <int, NotUsed> >, ISubscription, Func <Source <int, NotUsed> > > run = null) { var source = Source.From(Enumerable.Range(1, elementCount)); var groupStream = source.SplitWhen(substreamCancelStrategy, i => i == splitWhen) .Lift() .RunWith(Sink.AsPublisher <Source <int, NotUsed> >(false), Materializer); var masterSubscriber = TestSubscriber.CreateManualSubscriberProbe <Source <int, NotUsed> >(this); groupStream.Subscribe(masterSubscriber); var masterSubscription = masterSubscriber.ExpectSubscription(); run?.Invoke(masterSubscriber, masterSubscription, () => { masterSubscription.Request(1); return(masterSubscriber.ExpectNext()); }); }