예제 #1
0
        public void UdpConnection_should_bind_to_outbound_ephemeral_port()
        {
            var serverAddress = NodeBuilder.BuildNode().Host(IPAddress.Loopback).WithPort(13171);
            var server        =
                new ServerBootstrap().SetTransport(TransportType.Udp).Build().NewReactor(serverAddress);
            var connection = new ClientBootstrap().SetTransport(TransportType.Udp)
                             .Build()
                             .NewConnection(Node.Loopback(), serverAddress);

            server.Start();
            connection.Open();
            Assert.NotEqual(0, connection.Local.Port);
            connection.Close();
            server.Stop();
        }