Ejemplo n.º 1
0
        /// <summary>
        /// Ininitializes a new instance of the <see cref="NullChannel"/> class.
        /// </summary>
        /// <param name="channelName">Channel name.</param>
        /// <param name="clientSinkProvider">The client sink provider.</param>
        /// <param name="serverSinkProvider">The server sink provider.</param>
        public NullChannel(string channelName = "NullChannel", IClientChannelSinkProvider clientSinkProvider = null, IServerChannelSinkProvider serverSinkProvider = null)
        {
            ChannelName      = channelName;
            ChannelDataStore = new ChannelDataStore(new[] { "null://" + channelName });

            // standard mode: message serialization must be enabled
            if (clientSinkProvider != null || serverSinkProvider != null)
            {
                InitializeWithFormatters(clientSinkProvider, serverSinkProvider);
            }
            else
            {
                // fast mode (no additional sinks specified) — bypass serialization
                ClientSinkProvider = new NullClientChannelSink.Provider();
                ServerSink         = new NullServerChannelSink(null);
            }

            // start listening for messages
            StartListening(null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Ininitializes a new instance of the <see cref="NullChannel"/> class.
        /// </summary>
        /// <param name="channelName">Channel name.</param>
        /// <param name="clientSinkProvider">The client sink provider.</param>
        /// <param name="serverSinkProvider">The server sink provider.</param>
        public NullChannel(string channelName = "NullChannel", IClientChannelSinkProvider clientSinkProvider = null, IServerChannelSinkProvider serverSinkProvider = null)
        {
            ChannelName = channelName;
            ChannelDataStore = new ChannelDataStore(new[] { "null://" + channelName });

            // standard mode: message serialization must be enabled
            if (clientSinkProvider != null || serverSinkProvider != null)
            {
                InitializeWithFormatters(clientSinkProvider, serverSinkProvider);
            }
            else
            {
                // fast mode (no additional sinks specified) — bypass serialization
                ClientSinkProvider = new NullClientChannelSink.Provider();
                ServerSink = new NullServerChannelSink(null);
            }

            // start listening for messages
            StartListening(null);
        }