public static int GetPort()
        {
            int?result = null;

            while (result == null)
            {
                result = PortGenerator.GetPortLock();
                if (result == null)
                {
                    Thread.Sleep(WaitMilliseconds);
                }
            }
            return(result ?? throw new ArgumentOutOfRangeException("genereted port cannot be null"));
        }
Esempio n. 2
0
 public AppInstance()
 {
     Port = PortGenerator.GetPort();
     App  = ConfigureApp().Build();
     App.RunAsync();
 }