Example #1
0
        public void PortExhaustionTest()
        {
            // temporarly decrease the verbosity to prevent useless entries from getting logged
            AssemblyGlobals.Logger.Level = LogLevel.Warn;

            XboxConnectionOptions options = XboxConnectionOptions.PerformanceMode;

            for (int i = 0; i < 50; i++)
            {
                using (_connection = new XboxConnection(AssemblyGlobals.Logger))
                {
                    // register notification session every other connection
                    _connection.Open(AssemblyGlobals.TestXbox.Ip, options ^= XboxConnectionOptions.NotificationSession);

                    // get active xbox connections
                    int connectionCount =
                        IPGlobalProperties.GetIPGlobalProperties()
                        .GetActiveTcpConnections()
                        .Count(connection => Equals(connection.RemoteEndPoint.Address, AssemblyGlobals.TestXbox.Ip));

                    // fail if we detect they aren't being closed properly
                    if (connectionCount > 10)
                    {
                        Assert.Fail();
                    }
                }
            }
        }
Example #2
0
 /// <summary>
 /// Connects to an Xbox with the specified ip address. If already connected, it will reconnect.
 /// </summary>
 /// <param name="ip"></param>
 /// <param name="options"></param>
 public void Connect(IPAddress ip, XboxConnectionOptions options = XboxConnectionOptions.PerformanceMode)
 {
     Disconnect();
     CommandSession = new XboxConnection(Logger);
     CommandSession.Open(ip, options);
     PreviousConnectionAddress = CommandSession.Ip;
     PreviousConnectionOptions = CommandSession.Options;
     NotificationSession       = new XboxConnection(Logger);
     NotificationSession.Open(ip, XboxConnectionOptions.NotificationSession);
     Initialize();
 }
Example #3
0
 public void OpenTest()
 {
     _connection.Open(AssemblyGlobals.TestXbox.Ip);
 }