aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/GrpcApiTests/MathClientServerTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/csharp/GrpcApiTests/MathClientServerTests.cs')
-rw-r--r--src/csharp/GrpcApiTests/MathClientServerTests.cs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/csharp/GrpcApiTests/MathClientServerTests.cs b/src/csharp/GrpcApiTests/MathClientServerTests.cs
index f5c74573de..bb3f75d4ac 100644
--- a/src/csharp/GrpcApiTests/MathClientServerTests.cs
+++ b/src/csharp/GrpcApiTests/MathClientServerTests.cs
@@ -46,7 +46,7 @@ namespace math.Tests
/// </summary>
public class MathClientServerTest
{
- string serverAddr = "localhost:" + PortPicker.PickUnusedPort();
+ string host = "localhost";
Server server;
Channel channel;
MathGrpc.IMathServiceClient client;
@@ -54,11 +54,13 @@ namespace math.Tests
[TestFixtureSetUp]
public void Init()
{
+ GrpcEnvironment.Initialize();
+
server = new Server();
server.AddServiceDefinition(MathGrpc.BindService(new MathServiceImpl()));
- server.AddPort(serverAddr);
+ int port = server.AddPort(host + ":0");
server.Start();
- channel = new Channel(serverAddr);
+ channel = new Channel(host + ":" + port);
client = MathGrpc.NewStub(channel);
}