public async Task Subscribe_To_Message_Stream_Should_Return_VersionRequest() { await _rpcServer.StartAsync(); VersionRequest returnedVersionRequest = null; var targetVersionRequest = new VersionRequest { Query = true }; var protocolMessage = targetVersionRequest.ToProtocolMessage(_peerId, CorrelationId.GenerateCorrelationId()); var observerDto = new ObserverDto(_channelHandlerContext, protocolMessage); _rpcServer.MessageStream .Where(x => x.Payload != null && x.Payload.TypeUrl == typeof(VersionRequest).ShortenedProtoFullName()) .SubscribeOn(_testScheduler) .Subscribe(request => returnedVersionRequest = request.Payload.FromProtocolMessage <VersionRequest>()); _mockSocketReplySubject.OnNext(observerDto); _testScheduler.Start(); targetVersionRequest.Should().Be(returnedVersionRequest); }