private PayloadSizeEstimator payloadEstimator; // Used to estimate the buffer required to serialize // the next message sent /// <summary> /// Constructor. /// </summary> /// <param name="channelManager">The responsible channel manager.</param> /// <param name="remoteAddress">The remote <see cref="EndpointAddress" />.</param> /// <param name="via">The first transport hop <see cref="Uri" />.</param> /// <param name="encoder">The <see cref="MessageEncoder" /> for serializing messages to the wire format.</param> public OutputChannel(ChannelManagerBase channelManager, EndpointAddress remoteAddress, Uri via, MessageEncoder encoder) : base(channelManager) { ServiceModelHelper.ValidateEP(remoteAddress.Uri); ServiceModelHelper.ValidateEP(via); this.remoteAddress = remoteAddress; this.via = via; this.encoder = encoder; this.ep = ServiceModelHelper.ToMsgEP(remoteAddress.Uri); this.payloadEstimator = new PayloadSizeEstimator(ServiceModelHelper.PayloadEstimatorSampleCount); }
private DuplexSession session; // Underlying LillTek Messaging session /// <summary> /// Constructor. /// </summary> /// <param name="channelManager">The responsible channel manager.</param> /// <param name="remoteAddress">The remote <see cref="EndpointAddress" />.</param> /// <param name="via">The first transport hop <see cref="Uri" />.</param> /// <param name="encoder">The <see cref="MessageEncoder" /> for serializing messages to the wire format.</param> public OutputSessionChannel(ChannelManagerBase channelManager, EndpointAddress remoteAddress, Uri via, MessageEncoder encoder) : base(channelManager) { ServiceModelHelper.ValidateEP(remoteAddress.Uri); ServiceModelHelper.ValidateEP(via); this.ep = ServiceModelHelper.ToMsgEP(remoteAddress.Uri); if (ep.Broadcast) { throw new ArgumentException("Sessionful channels cannot accept broadcast endpoints.", "remoteAddress"); } this.remoteAddress = remoteAddress; this.via = via; this.encoder = encoder; this.payloadEstimator = new PayloadSizeEstimator(ServiceModelHelper.PayloadEstimatorSampleCount); this.session = ChannelHost.Router.CreateDuplexSession(); }
public void ServiceModelHelper_ValidateEP() { ServiceModelHelper.ValidateEP(new Uri("lilltek.logical://test")); ServiceModelHelper.ValidateEP(new Uri("lilltek.abstract://test")); try { ServiceModelHelper.ValidateEP(new Uri("lilltek.physical://test")); Assert.Fail("Expected an ArgumentException"); } catch (ArgumentException) { } try { ServiceModelHelper.ValidateEP(new Uri("http://test")); Assert.Fail("Expected an ArgumentException"); } catch (ArgumentException) { } try { ServiceModelHelper.ValidateEP(new Uri("lilltek.logical://test:80")); Assert.Fail("Expected an ArgumentException"); } catch (ArgumentException) { } try { ServiceModelHelper.ValidateEP(new Uri("lilltek.abstract://test:80")); Assert.Fail("Expected an ArgumentException"); } catch (ArgumentException) { } }