private void thread_Source()
        {
            try
            {
                IFieldFailureDataLogger logger = FieldFailureDataHelper.CreateUnreliableFailureDataLogger("ffda", IPAddress.Loopback, SOURCE_PORT);

                logger.LogSST();
                logger.LogSEN();

                step2.Set();
            }
            catch (Exception ex) { Assert.Fail("Test failed: {0}", ex); }
        }
        public void FFDATest()
        {
            FilterBase ffda_filter =
                new FacilityEqualsFilter()
            {
                facility = SyslogFacility.Local0
            } &
            new PropertyFilter()
            {
                comparison = ComparisonOperator.eq, propertyName = Property.MessageID, value = "FFDA"
            };

            StringBuilder markup = new StringBuilder();

            new XmlSerializer(typeof(FilterBase)).Serialize(XmlTextWriter.Create(markup, new XmlWriterSettings()
            {
                Indent = true
            }), ffda_filter, ffda_filter.xmlns);

            TestContext.WriteLine("{0}", markup.ToString());

            const int SEND_PORT = 5427;

            //Init Logbus
            LogbusServerConfiguration core_config = new LogbusServerConfiguration();

            core_config.corefilter = ffda_filter;
            InboundChannelDefinition in_ch = new InboundChannelDefinition();

            in_ch.type  = "SyslogUdpReceiver";
            in_ch.param = new KeyValuePair[]
            {
                new KeyValuePair()
                {
                    name  = "port",
                    value = SEND_PORT.ToString()
                }
            };
            core_config.inchannels = new InboundChannelDefinition[] { in_ch };

            using (ILogBus logbus = new LogbusService(core_config))
            {
                logbus.MessageReceived += new EventHandler <SyslogMessageEventArgs>(logbus_MessageReceived);
                logbus.Start();

                //Init FFDA
                LogbusLoggerConfiguration source_config = new LogbusLoggerConfiguration();
                LoggerDefinition          udp_def       = new LoggerDefinition()
                {
                    type  = "SyslogUdpCollector",
                    param = new KeyValuePair[] { new KeyValuePair()
                                                 {
                                                     name = "port", value = SEND_PORT.ToString()
                                                 }, new KeyValuePair()
                                                 {
                                                     name = "ip", value = "127.0.0.1"
                                                 } }
                };
                source_config.logger       = new LoggerDefinition[] { udp_def };
                LoggerHelper.Configuration = source_config;

                //Send what we want: 2 FFDA messages
                IFieldFailureDataLogger logger = FieldFailureDataHelper.CreateFailureDataLogger("ffda");
                logger.LogSST();
                logger.LogSEN();

                //Send junk
                ILog junk_log = LoggerHelper.GetLogger();
                junk_log.Debug("Hello");
                junk_log.Error("Junk error");

                Thread.Sleep(1000);
                logbus.Stop();
            }

            Assert.AreEqual(2, messages);
        }