public void Init()
        {
            backendService = new BackendServiceImpl();

            // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755
            backendServer = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) })
            {
                Services = { TestService.BindService(backendService) },
                Ports    = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } }
            };
            backendServer.Start();

            xdsInteropClient = new XdsInteropClient(new XdsInteropClient.ClientOptions
            {
                NumChannels   = 1,
                Qps           = 1,
                RpcTimeoutSec = 10,
                Rpc           = "UnaryCall",
                Server        = $"{Host}:{backendServer.Ports.Single().BoundPort}",
            });

            // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755
            lbStatsServer = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) })
            {
                Services = { LoadBalancerStatsService.BindService(new LoadBalancerStatsServiceImpl(xdsInteropClient.StatsWatcher)) },
                Ports    = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } }
            };
            lbStatsServer.Start();

            int port = lbStatsServer.Ports.Single().BoundPort;

            lbStatsChannel = new Channel(Host, port, ChannelCredentials.Insecure);
            lbStatsClient  = new LoadBalancerStatsService.LoadBalancerStatsServiceClient(lbStatsChannel);
        }
示例#2
0
 public static void Run(string[] args)
 {
     GrpcEnvironment.SetLogger(new ConsoleLogger());
     var parserResult = Parser.Default.ParseArguments <ClientOptions>(args)
                        .WithNotParsed(errors => Environment.Exit(1))
                        .WithParsed(options =>
     {
         var xdsInteropClient = new XdsInteropClient(options);
         xdsInteropClient.RunAsync().Wait();
     });
 }