add StartThrowsWithUnboundPortTest

pull/11353/head
Jan Tattermusch 8 years ago
parent 9d56717be4
commit 67206428a4
  1. 16
      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;
@ -80,6 +81,21 @@ namespace Grpc.Core.Tests
server.ShutdownAsync().Wait();
}
[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()
{

Loading…
Cancel
Save