コード例 #1
0
        public void GetTcpChannelReturnsChannelWithCorrectURI()
        {
            var channel = TcpChannelUtils.GetTcpChannel("test", 1234);

            using (CleanUpOnDispose(channel))
            {
                Assert.That(channel, HasChannelUris().EqualTo(new[] { "tcp://127.0.0.1:1234" }));
            }
        }
コード例 #2
0
        public void GetTcpChannelReturnsChannelWithCorrectNameForUnspecifiedPort()
        {
            var channel = TcpChannelUtils.GetTcpChannel("test", 0);

            using (CleanUpOnDispose(channel))
            {
                Assert.That(channel, HasChannelName().EqualTo("test"));
            }
        }
コード例 #3
0
        public void GetTcpChannelReturnsSameChannelForSameNameUnspecifiedPorts()
        {
            var first = TcpChannelUtils.GetTcpChannel("test", 0);

            using (CleanUpOnDispose(first))
            {
                var second = TcpChannelUtils.GetTcpChannel("test", 0);
                Assert.That(second, Is.SameAs(first));
            }
        }
コード例 #4
0
        public void GetTcpChannelReturnsSameChannelForSameNameDifferentPort()
        {
            var first = TcpChannelUtils.GetTcpChannel("test", 1234);

            using (CleanUpOnDispose(first))
            {
                var second = TcpChannelUtils.GetTcpChannel("test", 4321);
                Assert.That(second, Is.SameAs(first));
            }
        }
コード例 #5
0
        public bool Start()
        {
            lock (_theLock)
            {
                _channel = TcpChannelUtils.GetTcpChannel(_uri + "Channel", _port, 100);

                RemotingServices.Marshal(this, _uri);
                _isMarshalled = true;
            }

            if (_port == 0)
            {
                ChannelDataStore store = this._channel.ChannelData as ChannelDataStore;
                if (store != null)
                {
                    string channelUri = store.ChannelUris[0];
                    _port = int.Parse(channelUri.Substring(channelUri.LastIndexOf(':') + 1));
                }
            }

            return(true);
        }