public void TestAcceptLast() { string xml = "<remote-addresses xmlns=\"http://schemas.tangosol.com/cache\"><socket-address><address>127.0.0.1</address><port>80</port></socket-address><socket-address><address>127.0.0.1</address><port>81</port></socket-address></remote-addresses>"; IXmlDocument config = XmlHelper.LoadXml(new StringReader(xml)); Assert.IsNotNull(config); ConfigurableAddressProviderFactory factory = new ConfigurableAddressProviderFactory(); factory.Config = config; IAddressProvider addrProvider = factory.CreateAddressProvider(); Assert.IsNotNull(addrProvider); Assert.IsInstanceOf(typeof(ConfigurableAddressProvider), addrProvider); string addrProviderString = addrProvider.ToString(); Assert.IsTrue(addrProviderString.Equals("[127.0.0.1:81,127.0.0.1:80]") || addrProviderString.Equals("[127.0.0.1:80,127.0.0.1:81]")); IPEndPoint addr = addrProvider.NextAddress; Assert.IsNotNull(addr); addrProvider.Reject(null); addr = addrProvider.NextAddress; Assert.IsNotNull(addr); addrProvider.Accept(); addr = addrProvider.NextAddress; Assert.IsNotNull(addr); }
public void TestCreateAddressProvider1() { string xml = "<remote-addresses xmlns=\"http://schemas.tangosol.com/cache\"><socket-address><address>10.0.0.120</address><port>80</port></socket-address><socket-address><address>10.0.0.121</address><port>8080</port></socket-address></remote-addresses>"; IXmlDocument config = XmlHelper.LoadXml(new StringReader(xml)); Assert.IsNotNull(config); ConfigurableAddressProviderFactory factory = new ConfigurableAddressProviderFactory(); factory.Config = config; IAddressProvider addrProvider = factory.CreateAddressProvider(); Assert.IsNotNull(addrProvider); string addrProviderString = addrProvider.ToString(); Assert.IsTrue(addrProviderString.Equals("[10.0.0.121:8080,10.0.0.120:80]") || addrProviderString.Equals("[10.0.0.120:80,10.0.0.121:8080]")); Assert.IsInstanceOf(typeof(ConfigurableAddressProvider), addrProvider); }