aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2017-05-26 14:28:39 -0700
committerGravatar Jan Tattermusch <jtattermusch@google.com>2017-06-01 00:17:26 +0200
commit67206428a41124abcde3798fa39728064ef59ff8 (patch)
tree7ecd35e3b0455c3d978fb7de9565df60b2bb823e /src
parent9d56717be4fa5d0c05e42bb1137b30ef121960d8 (diff)
add StartThrowsWithUnboundPortTest
Diffstat (limited to 'src')
-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 3b51aa6330..5e95ed9ea6 100644
--- a/src/csharp/Grpc.Core.Tests/ServerTest.cs
+++ b/src/csharp/Grpc.Core.Tests/ServerTest.cs
@@ -32,6 +32,7 @@
#endregion
using System;
+using System.IO;
using System.Linq;
using Grpc.Core;
using Grpc.Core.Internal;
@@ -81,6 +82,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