@Test
 public void testNetworkConfig() {
   NetworkConfig networkConfig = config.getNetworkConfig();
   assertNotNull(networkConfig);
   assertEquals(5700, networkConfig.getPort());
   assertFalse(networkConfig.isPortAutoIncrement());
   final Collection<String> allowedPorts = networkConfig.getOutboundPortDefinitions();
   assertEquals(2, allowedPorts.size());
   Iterator portIter = allowedPorts.iterator();
   assertEquals("35000-35100", portIter.next());
   assertEquals("36000,36100", portIter.next());
   assertFalse(networkConfig.getJoin().getMulticastConfig().isEnabled());
   assertEquals(networkConfig.getJoin().getMulticastConfig().getMulticastTimeoutSeconds(), 8);
   assertEquals(networkConfig.getJoin().getMulticastConfig().getMulticastTimeToLive(), 16);
   assertFalse(networkConfig.getInterfaces().isEnabled());
   assertEquals(1, networkConfig.getInterfaces().getInterfaces().size());
   assertEquals("10.10.1.*", networkConfig.getInterfaces().getInterfaces().iterator().next());
   TcpIpConfig tcp = networkConfig.getJoin().getTcpIpConfig();
   assertNotNull(tcp);
   assertTrue(tcp.isEnabled());
   assertTrue(networkConfig.getSymmetricEncryptionConfig().isEnabled());
   final List<String> members = tcp.getMembers();
   assertEquals(members.toString(), 2, members.size());
   assertEquals("127.0.0.1:5700", members.get(0));
   assertEquals("127.0.0.1:5701", members.get(1));
   assertEquals("127.0.0.1:5700", tcp.getRequiredMember());
   AwsConfig aws = networkConfig.getJoin().getAwsConfig();
   assertFalse(aws.isEnabled());
   assertEquals("sample-access-key", aws.getAccessKey());
   assertEquals("sample-secret-key", aws.getSecretKey());
   assertEquals("sample-region", aws.getRegion());
   assertEquals("sample-group", aws.getSecurityGroupName());
   assertEquals("sample-tag-key", aws.getTagKey());
   assertEquals("sample-tag-value", aws.getTagValue());
 }
 @Test
 public void testSSLConfig() {
   SSLConfig sslConfig = config.getNetworkConfig().getSSLConfig();
   assertNotNull(sslConfig);
   assertFalse(sslConfig.isEnabled());
   assertEquals(DummySSLContextFactory.class.getName(), sslConfig.getFactoryClassName());
   assertEquals(sslContextFactory, sslConfig.getFactoryImplementation());
 }
 @Test
 public void testSocketInterceptorConfig() {
   SocketInterceptorConfig socketInterceptorConfig =
       config.getNetworkConfig().getSocketInterceptorConfig();
   assertNotNull(socketInterceptorConfig);
   assertFalse(socketInterceptorConfig.isEnabled());
   assertEquals(DummySocketInterceptor.class.getName(), socketInterceptorConfig.getClassName());
   assertEquals(socketInterceptor, socketInterceptorConfig.getImplementation());
 }
  @Test
  public void readPortAutoIncrement() {
    // explicitly set.
    Config config =
        buildConfig(
            "<hazelcast>\n"
                + "    <network>\n"
                + "        <port auto-increment=\"false\">5701</port>\n"
                + "    </network>\n"
                + "</hazelcast>");
    assertFalse(config.getNetworkConfig().isPortAutoIncrement());

    // check if the default is picked up correctly
    config =
        buildConfig(
            "<hazelcast>\n"
                + "    <network>\n"
                + "        <port>5701</port>\n"
                + "    </network>\n"
                + "</hazelcast>");
    assertTrue(config.getNetworkConfig().isPortAutoIncrement());
  }
  @Test
  public void readPortCount() {
    // check when it is explicitly set.
    Config config =
        buildConfig(
            "<hazelcast>\n"
                + "    <network>\n"
                + "        <port port-count=\"200\">5701</port>\n"
                + "    </network>\n"
                + "</hazelcast>");
    assertEquals(200, config.getNetworkConfig().getPortCount());

    // check if the default is passed in correctly
    config =
        buildConfig(
            "<hazelcast>\n"
                + "    <network>\n"
                + "        <port>5701</port>\n"
                + "    </network>\n"
                + "</hazelcast>");
    assertEquals(100, config.getNetworkConfig().getPortCount());
  }
 @Test
 public void readAwsConfig() {
   String xml =
       "<hazelcast>\n"
           + "   <group>\n"
           + "        <name>dev</name>\n"
           + "        <password>dev-pass</password>\n"
           + "    </group>\n"
           + "    <network>\n"
           + "        <port auto-increment=\"true\">5701</port>\n"
           + "        <join>\n"
           + "            <multicast enabled=\"false\">\n"
           + "                <multicast-group>224.2.2.3</multicast-group>\n"
           + "                <multicast-port>54327</multicast-port>\n"
           + "            </multicast>\n"
           + "            <tcp-ip enabled=\"false\">\n"
           + "                <interface>127.0.0.1</interface>\n"
           + "            </tcp-ip>\n"
           + "            <aws enabled=\"true\" connection-timeout-seconds=\"10\" >\n"
           + "                <access-key>access</access-key>\n"
           + "                <secret-key>secret</secret-key>\n"
           + "            </aws>\n"
           + "        </join>\n"
           + "        <interfaces enabled=\"false\">\n"
           + "            <interface>10.10.1.*</interface>\n"
           + "        </interfaces>\n"
           + "    </network>\n"
           + "</hazelcast>";
   Config config = buildConfig(xml);
   AwsConfig awsConfig = config.getNetworkConfig().getJoin().getAwsConfig();
   assertTrue(awsConfig.isEnabled());
   assertEquals(
       10, config.getNetworkConfig().getJoin().getAwsConfig().getConnectionTimeoutSeconds());
   assertEquals("access", awsConfig.getAccessKey());
   assertEquals("secret", awsConfig.getSecretKey());
 }