Пример #1
0
        public void Test_4()
        {
            if (log.IsDebugEnabled)
            {
                log.Debug("In Test: " + System.Reflection.MethodBase.GetCurrentMethod());
            }

            ConnectionInfo connection = new ConnectionInfo();

            connection.Addr = "localhost";
            connection.Port = 7777;

            TCPMessageChannelAcceptor channelAcceptor1 = channelMngr.StartNewListener(connection);

            channelMngr.CloseAcceptor(channelAcceptor1);

            TCPMessageChannelAcceptor channelAcceptor2 = channelMngr.StartNewListener(connection);

            System.Net.IPHostEntry hostEntry = System.Net.Dns.GetHostEntry(connection.Addr);
            System.Net.IPAddress   ipAddress = System.Net.Dns.GetHostEntry(hostEntry.HostName).AddressList[0];

            Assert.AreEqual(channelAcceptor1.IsClosed, true);
            Assert.AreEqual(channelAcceptor2.IsClosed, false);
            Assert.AreEqual(channelAcceptor2.LocalEndPoint.ToString(), ipAddress + ":7777");

            channelMngr.DumpChannelsInfo();
            channelMngr.CloseAcceptor(channelAcceptor2);
            Assert.AreEqual(channelAcceptor2.IsClosed, true);
            channelMngr.DumpChannelsInfo();
        }
Пример #2
0
 private void OnDumpCommsInfo(object sender, EventArgs e)
 {
     if (channelManager != null)
     {
         channelManager.DumpChannelsInfo();
     }
     else
     if (log.IsWarnEnabled)
     {
         log.Warn("Communications are not started");
     }
 }