Esempio n. 1
0
        public DiscoveryTransport(ICompositeTransport next) : base(next)
        {
            this.next = next;

            // Intercept the interrupted and resumed events so we can disable our
            // agent if its supports suspend / resume semantics.
            this.next.Interrupted = TransportInterrupted;
            this.next.Resumed     = TransportResumed;
        }
        /// <summary>
        /// Factory method for creating a DiscoveryTransport.  The Discovery Transport wraps the
        /// given ICompositeTransport and will add and remove Transport URIs as they are discovered.
        /// </summary>
        public static DiscoveryTransport CreateTransport(ICompositeTransport compositeTransport, URISupport.CompositeData compositeData, StringDictionary options)
        {
            DiscoveryTransport transport = new DiscoveryTransport(compositeTransport);

            URISupport.SetProperties(transport, options, "transport.");
            transport.Properties = options;

            Uri             discoveryAgentURI = compositeData.Components[0];
            IDiscoveryAgent discoveryAgent    = DiscoveryAgentFactory.CreateAgent(discoveryAgentURI);

            transport.DiscoveryAgent = discoveryAgent;

            return(transport);
        }