public RelayedOnewayChannelListener(BindingContext context, RelayedOnewayTransportBindingElement transportBindingElement) : base(context.Binding)
        {
            this.nameSettings = context.BindingParameters.Find <Microsoft.ServiceBus.NameSettings>();
            if (this.nameSettings == null)
            {
                this.nameSettings = new Microsoft.ServiceBus.NameSettings();
                this.nameSettings.ServiceSettings.ListenerType = ListenerType.Unicast;
            }
            this.scheme         = context.Binding.Scheme;
            this.messageVersion = context.Binding.MessageVersion;
            switch (context.ListenUriMode)
            {
            case ListenUriMode.Explicit:
            {
                this.SetUri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress);
                break;
            }

            case ListenUriMode.Unique:
            {
                this.SetUniqueUri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress);
                break;
            }
            }
            this.channel  = new RelayedOnewayChannelListener.RelayedOnewayInputChannel(this, new EndpointAddress(this.Uri, new AddressHeader[0]));
            base.Acceptor = new Microsoft.ServiceBus.Channels.InputChannelAcceptor(this, () => this.GetPendingException());
            this.ChannelAcceptor.EnqueueAndDispatch(this.channel, new Action(this.OnChannelDequeued));
            this.connection = RelayedOnewayManager.RegisterListener(context, transportBindingElement, this);
        }
        public static IRelayedOnewayListener RegisterListener(BindingContext context, RelayedOnewayTransportBindingElement transportBindingElement, RelayedOnewayChannelListener channelListener)
        {
            IRelayedOnewayListener relayedOnewayListener;

            lock (RelayedOnewayManager.listenerTable)
            {
                if (!RelayedOnewayManager.listenerTable.TryLookupUri(channelListener.BaseAddress, HostNameComparisonMode.Exact, out relayedOnewayListener) || !(RelayedOnewayManager.AppendSlash(relayedOnewayListener.Uri).ToString() == RelayedOnewayManager.AppendSlash(channelListener.BaseAddress).ToString()))
                {
                    relayedOnewayListener          = new RelayedOnewayListener(context, transportBindingElement, channelListener.BaseAddress, new EventTraceActivity());
                    relayedOnewayListener.Closing += new EventHandler(RelayedOnewayManager.OnListenerClosing);
                    RelayedOnewayManager.listenerTable.RegisterUri(channelListener.BaseAddress, HostNameComparisonMode.Exact, relayedOnewayListener);
                }
                else if (!relayedOnewayListener.NameSettings.IsCompatible(channelListener.NameSettings))
                {
                    throw Fx.Exception.AsError(new AddressAlreadyInUseException(SRClient.IncompatibleChannelListener), null);
                }
                relayedOnewayListener.Register(channelListener);
            }
            return(relayedOnewayListener);
        }
 public RelayedOnewayOutputChannel(RelayedOnewayChannelFactory channelFactory, BindingContext context, RelayedOnewayTransportBindingElement transportBindingElement, EndpointAddress to, Uri via) : base(channelFactory)
 {
     this.to         = to;
     this.via        = via;
     this.connection = RelayedOnewayManager.CreateConnection(context, transportBindingElement, via);
 }