public boolean register(String nodeId, List<ZookeeperNodeInfo> payload) {
        if (payload == null || payload.isEmpty()) {
            return false;
        }
        lock.lock();
        try {
            createPathIfNotExisted();
            if (member != null) {
                LOG.warn("GroupMember has already registered. Please deregister first.");
                return false;
            }
            String payloadString = getPropertiesString(payload);
            member = new GroupMember(client, path, nodeId, payloadString.getBytes());
            member.start();
            LOG.info("Register Node[" + nodeId + "] in path[" + path + "].");
            return true;
        } finally {
            lock.unlock();
        }
    }
@Test
    public void testRegister() throws Exception {
        List<ZookeeperNodeInfo> payload = new ArrayList<ZookeeperNodeInfo>();
        ZookeeperNodeInfo node1 = new ZookeeperNodeInfo();
        node1.setPrefix("foo");
        node1.setHost("127.0.0.1");
        node1.setPort(1234);
        node1.setDatabase("foo_db");
        node1.setUsername("foo");
        node1.setPassword("password");
        payload.add(node1);

        ZookeeperNodeInfo node2 = new ZookeeperNodeInfo();
        node2.setPrefix("bar");
        node2.setHost("127.0.0.1");
        node2.setPort(5678);
        node2.setUsername("bar");
        node2.setPassword("password");
        payload.add(node2);

        assertFalse(register.register("test-foo", null));
        assertTrue(register.register("test-foo", payload));
        assertFalse(register.register("test-foo", payload));

        Thread.sleep(1000); // Wait for the node to be created.

        CuratorFramework client = register.getClient();
        List<String> children = client.getChildren().forPath(PATH);
        assertFalse(children.isEmpty());
        assertEquals(1, children.size());
        assertEquals("test-foo", children.get(0));

        byte[] bytes = client.getData().forPath(PATH + "/test-foo");
        Properties properties = new Properties();
        String str = new String(bytes);
        LOG.info("ZK Data: " + str);
        properties.load(new StringReader(str));
        validateNodeProperties(node1, properties);
        validateNodeProperties(node2, properties);
        assertTrue(properties.containsKey("foo.database"));
        assertFalse(properties.containsKey("bar.database"));
        assertEquals("foo_db", properties.getProperty("foo.database"));
    }