Esempio n. 1
0
        public void ResolveProxyTypesLocal_ProxyObjectBase(ServerHost server, RemoteClient client, Type expectedType)
        {
            server.Start();
            client.ConnectAsync($"127.0.0.1:{server.ListenPort}").Wait();

            var proxy = client.GetRootObject <IMockRoot>();

            server.Dispose();
            client.Dispose();

            Assert.IsNotNull(proxy, "GetRootObject returned null!");
            Assert.IsTrue(proxy.GetType() == expectedType, $"Returned type not expected! {proxy} : {expectedType}");
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            Console.WriteLine("------------------------------------------------------------");
            Console.WriteLine("Queue Integration Tests");
            Console.WriteLine("------------------------------------------------------------");
            new QueuingTest().Run();

            Console.WriteLine("------------------------------------------------------------");
            Console.WriteLine("Start Server...");
            Console.WriteLine("------------------------------------------------------------");
            var settings   = InEngineSettings.Make();
            var serverHost = new ServerHost()
            {
                MailSettings  = settings.Mail,
                QueueSettings = settings.Queue,
            };

            serverHost.Start();
            Console.ReadLine();
            serverHost.Dispose();
        }
Esempio n. 3
0
        /// <summary>
        /// Start the server as a service or as a CLI program in the foreground.
        /// </summary>
        public static void RunServer()
        {
            var settings = InEngineSettings.Make();

            ServerHost = new ServerHost()
            {
                MailSettings  = settings.Mail,
                QueueSettings = settings.Queue,
            };

            if (!Environment.UserInteractive && Type.GetType("Mono.Runtime") == null)
            {
                using (var service = new Service())
                    ServiceBase.Run(service);
            }
            else
            {
                ServerHost.Start();
                Console.WriteLine("Press any key to exit...");
                Console.ReadLine();
                ServerHost.Dispose();
            }
        }
Esempio n. 4
0
        private void StopHosting()
        {
            try
            {
                if (_socketServer != null)
                {
                    _socketServer.StopListening();
                }

                if (_managementSocketServer != null)
                {
                    _managementSocketServer.StopListening();
                }

                if (_nchost != null)
                {
                    _nchost.StopHosting();
                    _nchost.Dispose();
                    _nchost.CacheServer.FeatureDataManager.StoptGatheringData();
                    _nchost.CacheServer.FeatureDataManager.StopPostingData();
                }

                if (_socketServer != null)
                {
                    _socketServer.Stop();
                }

                if (_managementSocketServer != null)
                {
                    _managementSocketServer.Stop();
                }

                if (_expiryWarningTask != null)
                {
                    _expiryWarningTask.Dispose();
                }

                if (_evalWarningTask != null)
                {
                    _evalWarningTask.Close();
                }

                if (_cacheServerEvalTask != null)
                {
                    _cacheServerEvalTask.Close();
                }
            }
            catch (ThreadAbortException te)
            {
                return;
            }
            catch (ThreadInterruptedException te)
            {
                return;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                try
                {
                    lock (_stop_mutex)
                    {
                        Monitor.PulseAll(_stop_mutex);
                    }
                }
                catch (Exception) { }
            }
        }
Esempio n. 5
0
        private void StopHosting()
        {
            try
            {
                if (_socketServer != null)
                {
                    _socketServer.StopListening();
                }

                if (_managementSocketServer != null)
                {
                    _managementSocketServer.StopListening();
                }

                if (_nchost != null)
                {
                    _nchost.CacheServer.DisposePerfmonSets();
                }
                if (_nchost != null)
                {
                    _nchost.CacheServer.DisposePerfmonSets();
                    _nchost.StopHosting();
                    _nchost.Dispose();
                }

                if (_socketServer != null)
                {
                    _socketServer.Stop();
                }

                if (_managementSocketServer != null)
                {
                    _managementSocketServer.Stop();
                }



                if (_evalWarningTask != null)
                {
                    _evalWarningTask.Close();
                }

                if (_cacheServerEvalTask != null)
                {
                    _cacheServerEvalTask.Close();
                }
            }
            catch (ThreadAbortException te)
            {
                return;
            }
            catch (ThreadInterruptedException te)
            {
                return;
            }
            catch (Exception ex)
            {
                //  AppUtil.LogEvent(_cacheserver, ex.ToString(), EventLogEntryType.Error, EventCategories.Error, EventID.GeneralError);
                throw ex;
            }
            finally
            {
                try
                {
                    lock (_stop_mutex)
                    {
                        Monitor.PulseAll(_stop_mutex);
                    }
                }
                catch (Exception) { }
            }
        }
Esempio n. 6
0
 public static void CleanUp()
 {
     _client.Dispose();
     _server.Dispose();
 }