コード例 #1
0
        public virtual void TestShouldCreateDatagramSocketByDefault()
        {
            SubsetConfiguration conf        = new ConfigBuilder().Subset("test.sink.ganglia");
            GangliaSink30       gangliaSink = new GangliaSink30();

            gangliaSink.Init(conf);
            DatagramSocket socket = gangliaSink.GetDatagramSocket();

            NUnit.Framework.Assert.IsFalse("Did not create DatagramSocket", socket == null ||
                                           socket is MulticastSocket);
        }
コード例 #2
0
        public virtual void TestShouldSetMulticastSocketTtl()
        {
            SubsetConfiguration conf = new ConfigBuilder().Add("test.sink.ganglia.multicast",
                                                               true).Add("test.sink.ganglia.multicast.ttl", 3).Subset("test.sink.ganglia");
            GangliaSink30 gangliaSink = new GangliaSink30();

            gangliaSink.Init(conf);
            DatagramSocket socket = gangliaSink.GetDatagramSocket();

            Assert.True("Did not create MulticastSocket", socket != null &&
                        socket is MulticastSocket);
            int ttl = ((MulticastSocket)socket).GetTimeToLive();

            Assert.Equal("Did not set TTL", 3, ttl);
        }