aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.IntegrationTesting
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2015-09-24 10:34:05 -0700
committerGravatar Jan Tattermusch <jtattermusch@google.com>2015-10-06 14:07:42 -0700
commit9e5e7e9a6cde7f9d91b00cb65b3c99e01916c813 (patch)
tree24990501193abcefe5220437a836f9214a630ec8 /src/csharp/Grpc.IntegrationTesting
parent74f39e185eaddfb07e9b024b0d8aec547cd83821 (diff)
a small interop client refactoring
Diffstat (limited to 'src/csharp/Grpc.IntegrationTesting')
-rw-r--r--src/csharp/Grpc.IntegrationTesting/InteropClient.cs32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
index d3b7fe87f3..c99084d1a9 100644
--- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
@@ -116,6 +116,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;
if (options.TestCase == "jwt_token_creds")
@@ -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)