public virtual void TestShouldCreateDatagramSocketByDefault() { GangliaContext context = new GangliaContext(); context.Init("gangliaContext", ContextFactory.GetFactory()); NUnit.Framework.Assert.IsFalse("Created MulticastSocket", context.datagramSocket is MulticastSocket); }
public virtual void TestShouldCreateDatagramSocketIfMulticastIsDisabled() { GangliaContext context = new GangliaContext(); ContextFactory factory = ContextFactory.GetFactory(); factory.SetAttribute("gangliaContext.multicast", "false"); context.Init("gangliaContext", factory); NUnit.Framework.Assert.IsFalse("Created MulticastSocket", context.datagramSocket is MulticastSocket); }
public virtual void TestCloseShouldCloseTheSocketWhichIsCreatedByInit() { AbstractMetricsContext context = new GangliaContext(); context.Init("gangliaContext", ContextFactory.GetFactory()); GangliaContext gangliaContext = (GangliaContext)context; NUnit.Framework.Assert.IsFalse("Socket already closed", gangliaContext.datagramSocket .IsClosed()); context.Close(); Assert.True("Socket not closed", gangliaContext.datagramSocket. IsClosed()); }
public virtual void TestShouldSetMulticastSocketTtl() { GangliaContext context = new GangliaContext(); ContextFactory factory = ContextFactory.GetFactory(); factory.SetAttribute("gangliaContext.multicast", "true"); factory.SetAttribute("gangliaContext.multicast.ttl", "10"); context.Init("gangliaContext", factory); MulticastSocket multicastSocket = (MulticastSocket)context.datagramSocket; Assert.Equal("Did not set TTL", multicastSocket.GetTimeToLive( ), 10); }
public virtual void TestShouldCreateMulticastSocket() { GangliaContext context = new GangliaContext(); ContextFactory factory = ContextFactory.GetFactory(); factory.SetAttribute("gangliaContext.multicast", "true"); context.Init("gangliaContext", factory); Assert.True("Did not create MulticastSocket", context.datagramSocket is MulticastSocket); MulticastSocket multicastSocket = (MulticastSocket)context.datagramSocket; Assert.Equal("Did not set default TTL", multicastSocket.GetTimeToLive (), 1); }