Akka.Remote.Tests.RemoteMessageLocalDeliverySpec.RemoteActorRefProvider_should_correctly_resolve_valid_LocalActorRef_from_second_remote_system C# (CSharp) Метод

RemoteActorRefProvider_should_correctly_resolve_valid_LocalActorRef_from_second_remote_system() приватный Метод

        public void RemoteActorRefProvider_should_correctly_resolve_valid_LocalActorRef_from_second_remote_system()
        {
           var sys2 = ActorSystem.Create("Sys2", RemoteConfiguration);
            try
            {
                Within(TimeSpan.FromSeconds(15), () =>
                {
                    var actorRef = sys2.ActorOf(BlackHoleActor.Props, "myActor");
                    var sys2Address = RARP.For(sys2).Provider.DefaultAddress;
                    var actorPath = new RootActorPath(sys2Address) / "user" / "myActor";

                    // get a remoteactorref for the second system
                    var remoteActorRef = Sys.ActorSelection(actorPath).ResolveOne(TimeSpan.FromSeconds(3)).Result;

                    // disconnect us from the second actorsystem
                    var mc =
                        RARP.For(Sys)
                            .Provider.Transport.ManagementCommand(new SetThrottle(sys2Address,
                                ThrottleTransportAdapter.Direction.Both, Blackhole.Instance));
                    Assert.True(mc.Wait(TimeSpan.FromSeconds(3)));

                    // start deathwatch (won't be delivered initially)
                    Watch(remoteActorRef);
                    Task.Delay(TimeSpan.FromSeconds(3)).Wait(); // if we delay the initial send, this spec will fail

                    var mc2 =
                       RARP.For(Sys)
                           .Provider.Transport.ManagementCommand(new SetThrottle(sys2Address,
                               ThrottleTransportAdapter.Direction.Both, Unthrottled.Instance));
                    Assert.True(mc2.Wait(TimeSpan.FromSeconds(3)));

                    // fire off another non-system message
                    var ai =
                        Sys.ActorSelection(actorPath).Ask<ActorIdentity>(new Identify(null), TimeSpan.FromSeconds(3)).Result;

                   
                    remoteActorRef.Tell(PoisonPill.Instance); // WATCH should be applied first
                    ExpectTerminated(remoteActorRef);
                });
            }
            finally
            {
                Assert.True(sys2.Terminate().Wait(TimeSpan.FromSeconds(5)));
            }
        }
    }