Пример #1
0
        protected override int CreateServer()
        {
            AppDomain domain = BaseCallTest.CreateDomain("testdomain");

            server = (CrossDomainServer)domain.CreateInstanceAndUnwrap(GetType().Assembly.FullName, "MonoTests.Remoting.CrossDomainServer");
            return(server.GetDomId());
        }
        public void Run()
        {
            try
            {
                tcp = new TcpChannel(0);

                Hashtable options = new Hashtable();
                options ["timeout"] = 10000; // 10s
                http = new HttpClientChannel(options, null);

                ChannelServices.RegisterChannel(tcp);
                ChannelServices.RegisterChannel(http);

                AppDomain domain = BaseCallTest.CreateDomain("testdomain_activation");
                server = (ActivationServer)domain.CreateInstanceAndUnwrap(GetType().Assembly.FullName, "MonoTests.Remoting.ActivationServer");

                RemotingConfiguration.RegisterActivatedClientType(typeof(CaObject1), "tcp://localhost:9433");
                RemotingConfiguration.RegisterActivatedClientType(typeof(CaObject2), "http://localhost:9434");
                RemotingConfiguration.RegisterWellKnownClientType(typeof(WkObjectSinglecall1), "tcp://localhost:9433/wkoSingleCall1");
                RemotingConfiguration.RegisterWellKnownClientType(typeof(WkObjectSingleton1), "tcp://localhost:9433/wkoSingleton1");
                RemotingConfiguration.RegisterWellKnownClientType(typeof(WkObjectSinglecall2), "http://localhost:9434/wkoSingleCall2");
                RemotingConfiguration.RegisterWellKnownClientType(typeof(WkObjectSingleton2), "http://localhost:9434/wkoSingleton2");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Пример #3
0
        public void Run()
        {
            try
            {
                Hashtable tcpOptions = new Hashtable();
                tcpOptions ["port"]   = 0;
                tcpOptions ["bindTo"] = "127.0.0.1";
                tcp = new TcpChannel(tcpOptions, null, null);

                Hashtable options = new Hashtable();
                options ["timeout"] = 10000;                 // 10s
                http = new HttpClientChannel(options, null);

                ChannelServices.RegisterChannel(tcp);
                ChannelServices.RegisterChannel(http);

                AppDomain domain = BaseCallTest.CreateDomain("testdomain_activation");
                server = (ActivationServer)domain.CreateInstanceAndUnwrap(GetType().Assembly.FullName, "MonoTests.Remoting.ActivationServer");

                var tcpUrlPrefix  = $"tcp://127.0.0.1:{server.TcpPort}";
                var httpUrlPrefix = $"http://127.0.0.1:{server.HttpPort}";
                RemotingConfiguration.RegisterActivatedClientType(typeof(CaObject1), tcpUrlPrefix);
                RemotingConfiguration.RegisterActivatedClientType(typeof(CaObject2), httpUrlPrefix);
                RemotingConfiguration.RegisterWellKnownClientType(typeof(WkObjectSinglecall1), tcpUrlPrefix + "/wkoSingleCall1");
                RemotingConfiguration.RegisterWellKnownClientType(typeof(WkObjectSingleton1), tcpUrlPrefix + "/wkoSingleton1");
                RemotingConfiguration.RegisterWellKnownClientType(typeof(WkObjectSinglecall2), httpUrlPrefix + "/wkoSingleCall2");
                RemotingConfiguration.RegisterWellKnownClientType(typeof(WkObjectSingleton2), httpUrlPrefix + "/wkoSingleton2");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Пример #4
0
        static T RegisterAndConnect <T> () where T : MarshalByRefObject
        {
            AppDomain d = BaseCallTest.CreateDomain("GenericTests");

            return((T)d.CreateInstanceAndUnwrap(
                       typeof(T).Assembly.FullName,
                       typeof(T).FullName));
        }
Пример #5
0
        protected virtual int CreateServer()
        {
            ChannelManager cm = CreateChannelManager();

            chs = cm.CreateClientChannel();
            ChannelServices.RegisterChannel(chs);

            AppDomain domain = BaseCallTest.CreateDomain("testdomain");

            server     = (CallsDomainServer)domain.CreateInstanceAndUnwrap(GetType().Assembly.FullName, "MonoTests.Remoting.CallsDomainServer");
            remoteUris = server.Start(cm);
            return(server.GetDomId());
        }