public override void Configure(IConfiguration configuration, IClientBuilder clientBuilder) { var primaryGw = this.ClusterConfiguration.Overrides["Primary"].ProxyGatewayEndpoint.ToGatewayUri(); clientBuilder.ConfigureServices(services => { services.AddSingleton(sp => { var gateway = new TestGatewayManager(); gateway.Gateways.Add(primaryGw); return(gateway); }); services.AddFromExisting <IGatewayListProvider, TestGatewayManager>(); }); }
public void Configure(IConfiguration configuration, IClientBuilder clientBuilder) { var basePort = int.Parse(configuration[nameof(TestClusterOptions.BaseGatewayPort)]); var primaryGw = new IPEndPoint(IPAddress.Loopback, basePort).ToGatewayUri(); clientBuilder.Configure <GatewayOptions>(options => { options.GatewayListRefreshPeriod = TimeSpan.FromMilliseconds(100); }); clientBuilder.ConfigureServices(services => { services.AddSingleton(sp => { var gateway = new TestGatewayManager(); gateway.Gateways.Add(primaryGw); return(gateway); }); services.AddFromExisting <IGatewayListProvider, TestGatewayManager>(); }); }