public SsbChannelListener(SsbBindingElement bindingElement, BindingContext context)
            : base(context.Binding)
        {
            this.bindingElement    = bindingElement;
            originalBindingContext = context.Clone();
            //Address stuff
            if (context.ListenUriMode == ListenUriMode.Unique)
            {
                throw new ProtocolException("ListenUriMode.Unique is not supported. You must provide an explicit address");
            }
            Uri baseAddress = context.ListenUriBaseAddress;

            if (baseAddress == null)
            {
                throw new ProtocolException("Address is null. You must provide an exlpicit address");
            }


            listenUri = new SsbUri(BuildUri(baseAddress, context.ListenUriRelativeAddress));

            //copy properties from binding element
            // TODO how do we enforce MaxReceivedMessgeSize
            this.maxMessageSize = (int)bindingElement.MaxReceivedMessageSize;

            this.connstring    = bindingElement.SqlConnectionString;
            this.bufferManager = BufferManager.CreateBufferManager(bindingElement.MaxBufferPoolSize, this.maxMessageSize);
            MessageEncodingBindingElement messageEncoderBindingElement = context.BindingParameters.Remove <MessageEncodingBindingElement>();

            if (messageEncoderBindingElement != null)
            {
                this.messageEncoderFactory = messageEncoderBindingElement.CreateMessageEncoderFactory();
            }
            else
            {
                this.messageEncoderFactory = SsbConstants.DefaultMessageEncoderFactory;
            }
        }
        internal SsbConversationSender(string connectionString, Uri via, SsbChannelFactory factory, bool endConversationOnClose, string contract, bool useEncryption)
        {
            if (String.IsNullOrEmpty(connectionString))
            {
                throw new ArgumentNullException("connectionString");
            }
            if (via == null)
            {
                throw new ArgumentNullException("via");
            }
            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }
            SsbUri ssburi = new SsbUri(via);

            this.source                 = ssburi.Client;
            this.target                 = ssburi.Service;
            this.connectionString       = connectionString;
            this.endConversationOnClose = endConversationOnClose;
            this.factory                = factory;
            this.contract               = contract;
            this.useEncryption          = useEncryption;
        }