public void CreateIPEndPointWithInvalidIPOrHost(string host) { if (host is null) { Assert.ThrowsAsync <ArgumentNullException>(() => LiteNetworkHelpers.CreateIpEndPointAsync(host, 4444)); } else { Assert.ThrowsAsync <AggregateException>(() => LiteNetworkHelpers.CreateIpEndPointAsync(host, 4444)); } }
/// <inheritdoc /> public async void Start() { if (IsRunning) { throw new InvalidOperationException("Server is already running."); } OnBeforeStart(); IPEndPoint localEndPoint = await LiteNetworkHelpers.CreateIpEndPointAsync(Options.Host, Options.Port).ConfigureAwait(false); _socket.Bind(localEndPoint); _socket.Listen(Options.Backlog); _acceptor.StartAccept(); IsRunning = true; OnAfterStart(); }
public async void CreateValidIPEndPoint(string ipAddress, int port) { var ipEndPoint = await LiteNetworkHelpers.CreateIpEndPointAsync(ipAddress, port); Assert.NotNull(ipEndPoint); }
public void CreateIPEndPointWithInvalidPort(int port) { Assert.ThrowsAsync <ArgumentOutOfRangeException>(() => LiteNetworkHelpers.CreateIpEndPointAsync("127.0.0.1", port)); }
public void BuildUnspecifiedAddress(string ipOrHost) { Assert.ThrowsAsync <ArgumentException>(() => LiteNetworkHelpers.CreateIpEndPointAsync(ipOrHost, 4444)); }