コード例 #1
0
ファイル: TestTransport.cs プロジェクト: yyp2003net/akka.net
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="system">TBD</param>
 /// <param name="conf">TBD</param>
 public TestTransport(ActorSystem system, Config conf)
     : this(
         Address.Parse(GetConfigString(conf, "local-address")),
         AssociationRegistry.Get(GetConfigString(conf, "registry-key")),
         conf.GetByteSize("maximum-payload-bytes") ?? 32000,
         GetConfigString(conf, "scheme-identifier")
         )
 {
 }
コード例 #2
0
        public TestTransport(Address localAddress, AssociationRegistry registry, string schemeIdentifier = "test")
        {
            LocalAddress     = localAddress;
            _registry        = registry;
            SchemeIdentifier = schemeIdentifier;
            ListenBehavior   =
                new SwitchableLoggedBehavior <bool, Tuple <Address, TaskCompletionSource <IAssociationEventListener> > >(
                    x => DefaultListen(), x => _registry.LogActivity(new ListenAttempt(LocalAddress)));
            AssociateBehavior =
                new SwitchableLoggedBehavior <Address, AssociationHandle>(DefaultAssociate, address => registry.LogActivity(new AssociateAttempt(LocalAddress, address)));
            ShutdownBehavior     = new SwitchableLoggedBehavior <bool, bool>(x => DefaultShutdown(), x => registry.LogActivity(new ShutdownAttempt(LocalAddress)));
            DisassociateBehavior = new SwitchableLoggedBehavior <TestAssociationHandle, bool>(x =>
            {
                DefaultDisassociate(x);
                return(Task.Run(() => true));
            }, remote => _registry.LogActivity(new DisassociateAttempt(remote.LocalAddress, remote.RemoteAddress)));

            WriteBehavior = new SwitchableLoggedBehavior <Tuple <TestAssociationHandle, ByteString>, bool>(
                args => DefaultWriteBehavior(args.Item1, args.Item2),
                data => _registry.LogActivity(new WriteAttempt(data.Item1.LocalAddress, data.Item1.RemoteAddress, data.Item2)));
        }
コード例 #3
0
 public TestTransport(ActorSystem system, Config conf)
     : this(
         Address.Parse(GetConfigString(conf, "local-address")), AssociationRegistry.Get(GetConfigString(conf, "registry-key")),
         GetConfigString(conf, "scheme-identifier"))
 {
 }