Exemple #1
0
        private static void WaitForServerConnectedStatus(string host, int port, int timeoutMs = 10000)
        {
            var manualResetEvent = new ManualResetEvent(false);
            var adminClient      = AdminClientFactory.CreateNew(host, port);

            adminClient.Stats += AdminClientOnStats;
            adminClient.Connect();

            var connected = manualResetEvent.WaitOne(timeoutMs);

            if (!connected)
            {
                throw new Exception($"Haven't received connected status with host: {host}:{port}");
            }

            adminClient.Stats -= AdminClientOnStats;
            adminClient.Disconnect();

            void AdminClientOnStats(StatsMessage message)
            {
                if (message.Status == StatsStatusType.Connected)
                {
                    manualResetEvent.Set();
                }
            }
        }
        public static void AdminClient_can_connect_and_terminate_without_error_forceIpv4(bool forceIpv4)
        {
            // Arrange
            SocketClient.ForceIpv4 = forceIpv4;

            // Act
            IQFeedLauncher.Start();

            var client = AdminClientFactory.CreateNew();

            client.Connect();
            client.Disconnect();

            IQFeedLauncher.Terminate();

            // Assert
            Assert.Pass($"IQFeedLauncher and the admin client were able to connect and disconnect/terminate without error with the 'SocketClient.ForceIpv4' value set to '{forceIpv4}'.");
        }
Exemple #3
0
 public void SetUp()
 {
     _adminClient = AdminClientFactory.CreateNew();
     _adminClient.Connect();
 }