aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/GrpcCoreTests/ClientServerTest.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/csharp/GrpcCoreTests/ClientServerTest.cs')
-rw-r--r--src/csharp/GrpcCoreTests/ClientServerTest.cs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/csharp/GrpcCoreTests/ClientServerTest.cs b/src/csharp/GrpcCoreTests/ClientServerTest.cs
index 1cfb6da0fa..1472db6e07 100644
--- a/src/csharp/GrpcCoreTests/ClientServerTest.cs
+++ b/src/csharp/GrpcCoreTests/ClientServerTest.cs
@@ -43,7 +43,7 @@ namespace Google.GRPC.Core.Tests
{
public class ClientServerTest
{
- string serverAddr = "localhost:" + PortPicker.PickUnusedPort();
+ string host = "localhost";
Method<string, string> unaryEchoStringMethod = new Method<string, string>(
MethodType.Unary,
@@ -54,15 +54,17 @@ namespace Google.GRPC.Core.Tests
[Test]
public void EmptyCall()
{
+ GrpcEnvironment.Initialize();
+
Server server = new Server();
server.AddServiceDefinition(
ServerServiceDefinition.CreateBuilder("someService")
.AddMethod(unaryEchoStringMethod, HandleUnaryEchoString).Build());
- server.AddPort(serverAddr);
+ int port = server.AddPort(host + ":0");
server.Start();
- using (Channel channel = new Channel(serverAddr))
+ using (Channel channel = new Channel(host + ":" + port))
{
var call = new Call<string, string>(unaryEchoStringMethod, channel);