protected virtual void SetDefaultTCPHTTPSettings() { _configSource = _kernel.Get <ISourceBlock <ServicePointManagerDefaultConfig> >(); _configSource.LinkTo(new ActionBlock <ServicePointManagerDefaultConfig>(cnf => SetServicePointManagerDefaultValues(cnf))); ServicePointManagerDefaultConfig config = _kernel.Get <Func <ServicePointManagerDefaultConfig> >()(); SetServicePointManagerDefaultValues(config); }
public void ServicePointManagerIsUpdated() { TestingKernel <ConsoleLog> kernel = new TestingKernel <ConsoleLog>(); ServicePointManagerDefaultConfig config = kernel.Get <Func <ServicePointManagerDefaultConfig> >()(); Assert.AreEqual(ServicePointManager.DefaultConnectionLimit, config.DefaultConnectionLimit); Assert.AreEqual(ServicePointManager.UseNagleAlgorithm, config.UseNagleAlgorithm); Assert.AreEqual(ServicePointManager.Expect100Continue, config.Expect100Continue); }
private void SetServicePointManagerDefaultValues(ServicePointManagerDefaultConfig config) { ServicePointManager.DefaultConnectionLimit = config.DefaultConnectionLimit; ServicePointManager.UseNagleAlgorithm = config.UseNagleAlgorithm; ServicePointManager.Expect100Continue = config.Expect100Continue; }