Skip to content
Snippets Groups Projects
Commit 9e5e7e9a authored by Jan Tattermusch's avatar Jan Tattermusch
Browse files

a small interop client refactoring

parent 74f39e18
No related branches found
No related tags found
No related merge requests found
......@@ -115,6 +115,24 @@ namespace Grpc.IntegrationTesting
}
private async Task Run()
{
var credentials = await CreateCredentialsAsync();
List<ChannelOption> channelOptions = null;
if (!string.IsNullOrEmpty(options.ServerHostOverride))
{
channelOptions = new List<ChannelOption>
{
new ChannelOption(ChannelOptions.SslTargetNameOverride, options.ServerHostOverride)
};
}
var channel = new Channel(options.ServerHost, options.ServerPort, credentials, channelOptions);
TestService.TestServiceClient client = new TestService.TestServiceClient(channel);
await RunTestCaseAsync(client, options);
await channel.ShutdownAsync();
}
private async Task<Credentials> CreateCredentialsAsync()
{
var credentials = options.UseTls ? TestCredentials.CreateTestClientCredentials(options.UseTestCa) : Credentials.Insecure;
......@@ -131,19 +149,7 @@ namespace Grpc.IntegrationTesting
Assert.IsFalse(googleCredential.IsCreateScopedRequired);
credentials = CompositeCredentials.Create(googleCredential.ToGrpcCredentials(), credentials);
}
List<ChannelOption> channelOptions = null;
if (!string.IsNullOrEmpty(options.ServerHostOverride))
{
channelOptions = new List<ChannelOption>
{
new ChannelOption(ChannelOptions.SslTargetNameOverride, options.ServerHostOverride)
};
}
var channel = new Channel(options.ServerHost, options.ServerPort, credentials, channelOptions);
TestService.TestServiceClient client = new TestService.TestServiceClient(channel);
await RunTestCaseAsync(client, options);
await channel.ShutdownAsync();
return credentials;
}
private async Task RunTestCaseAsync(TestService.TestServiceClient client, ClientOptions options)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment