public void GetTcpChannelReturnsChannelWithCorrectURI() { var channel = TcpChannelUtils.GetTcpChannel("test", 1234); using (CleanUpOnDispose(channel)) { Assert.That(channel, HasChannelUris().EqualTo(new[] { "tcp://127.0.0.1:1234" })); } }
public void GetTcpChannelReturnsChannelWithCorrectNameForUnspecifiedPort() { var channel = TcpChannelUtils.GetTcpChannel("test", 0); using (CleanUpOnDispose(channel)) { Assert.That(channel, HasChannelName().EqualTo("test")); } }
public void GetTcpChannelReturnsSameChannelForSameNameUnspecifiedPorts() { var first = TcpChannelUtils.GetTcpChannel("test", 0); using (CleanUpOnDispose(first)) { var second = TcpChannelUtils.GetTcpChannel("test", 0); Assert.That(second, Is.SameAs(first)); } }
public void GetTcpChannelReturnsSameChannelForSameNameDifferentPort() { var first = TcpChannelUtils.GetTcpChannel("test", 1234); using (CleanUpOnDispose(first)) { var second = TcpChannelUtils.GetTcpChannel("test", 4321); Assert.That(second, Is.SameAs(first)); } }
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); }