// For testing
        internal KestrelServerImpl(
            IEnumerable <IConnectionListenerFactory> transportFactories,
            IEnumerable <IMultiplexedConnectionListenerFactory>?multiplexedFactories,
            ServiceContext serviceContext)
        {
            if (transportFactories == null)
            {
                throw new ArgumentNullException(nameof(transportFactories));
            }

            _transportFactory            = transportFactories.LastOrDefault();
            _multiplexedTransportFactory = multiplexedFactories?.LastOrDefault();

            if (_transportFactory == null && _multiplexedTransportFactory == null)
            {
                throw new InvalidOperationException(CoreStrings.TransportNotFound);
            }

            ServiceContext = serviceContext;

            Features         = new FeatureCollection();
            _serverAddresses = new ServerAddressesFeature();
            Features.Set <IServerAddressesFeature>(_serverAddresses);

            _transportManager = new TransportManager(_transportFactory, _multiplexedTransportFactory, ServiceContext);

            HttpCharacters.Initialize();
        }
Beispiel #2
0
 public TransportManager(
     IConnectionListenerFactory?transportFactory,
     IMultiplexedConnectionListenerFactory?multiplexedTransportFactory,
     ServiceContext serviceContext)
 {
     _transportFactory            = transportFactory;
     _multiplexedTransportFactory = multiplexedTransportFactory;
     _serviceContext = serviceContext;
 }