aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core.Tests/ServerTest.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/csharp/Grpc.Core.Tests/ServerTest.cs')
-rw-r--r--src/csharp/Grpc.Core.Tests/ServerTest.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/csharp/Grpc.Core.Tests/ServerTest.cs b/src/csharp/Grpc.Core.Tests/ServerTest.cs
index f6343f2a13..884414792d 100644
--- a/src/csharp/Grpc.Core.Tests/ServerTest.cs
+++ b/src/csharp/Grpc.Core.Tests/ServerTest.cs
@@ -17,6 +17,7 @@
#endregion
using System;
+using System.IO;
using System.Linq;
using Grpc.Core;
using Grpc.Core.Internal;
@@ -66,6 +67,21 @@ namespace Grpc.Core.Tests
}
[Test]
+ public void StartThrowsWithUnboundPorts()
+ {
+ int twiceBoundPort = 9999;
+ Server server = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) })
+ {
+ Ports = {
+ new ServerPort("localhost", twiceBoundPort, ServerCredentials.Insecure),
+ new ServerPort("localhost", twiceBoundPort, ServerCredentials.Insecure)
+ }
+ };
+ Assert.Throws(typeof(IOException), () => server.Start());
+ server.ShutdownAsync().Wait();
+ }
+
+ [Test]
public void CannotModifyAfterStarted()
{
Server server = new Server