Util.sleep(500);
    public void testStateTransferWithReconnect() throws Exception {        ch1=factory.createMultiplexerChannel(STACK_NAME, "c1");        assertTrue(ch1.isOpen());        assertFalse(ch1.isConnected());        ch1.connect("bla");        assertTrue(ch1.isOpen());        assertTrue(ch1.isConnected());        assertServiceAndClusterView(ch1, 1, 1);        c1=new Cache(ch1, "cache-1");        assertEquals("cache has to be empty initially", 0, c1.size());        ch1_repl=factory2.createMultiplexerChannel(STACK_NAME, "c1");        assertTrue(ch1_repl.isOpen());        assertFalse(ch1_repl.isConnected());        c1.put("name", "Bela");        c1.put("id", new Long(322649));        c1.put("hobbies", "biking");        c1.put("bike", "Centurion");        ch1_repl.connect("bla");        assertTrue(ch1_repl.isOpen());        assertTrue(ch1_repl.isConnected());        assertServiceAndClusterView(ch1, 2, 2);        assertServiceAndClusterView(ch1_repl, 2, 2);        c1_repl=new Cache(ch1_repl, "cache-1-repl");        boolean rc=ch1_repl.getState(null, 5000);        System.out.println("state transfer: " + rc);        Util.sleep(500);        System.out.println("c1_repl: " + c1_repl);        assertEquals("initial state should have been transferred", 4, c1_repl.size());        assertEquals(new Long(322649), c1.get("id"));        assertEquals(new Long(322649), c1_repl.get("id"));        assertEquals("biking", c1.get("hobbies"));        assertEquals("biking", c1_repl.get("hobbies"));        assertEquals("Centurion", c1.get("bike"));        assertEquals("Centurion", c1_repl.get("bike"));        ch1_repl.disconnect();        assertTrue(ch1_repl.isOpen());        assertFalse(ch1_repl.isConnected());        assertServiceAndClusterView(ch1, 1, 1);        assertServiceAndClusterView(ch1_repl, 1, 1);        c1_repl.clear();        ch1_repl.connect("bla");        assertTrue(ch1_repl.isOpen());        assertTrue(ch1_repl.isConnected());        assertServiceAndClusterView(ch1, 2, 2);        assertServiceAndClusterView(ch1_repl, 2, 2);        assertEquals("cache has to be empty initially", 0, c1_repl.size());        rc=ch1_repl.getState(null, 5000);        System.out.println("state transfer: " + rc);        Util.sleep(500);        System.out.println("c1_repl: " + c1_repl);        assertEquals("initial state should have been transferred", 4, c1_repl.size());        assertEquals(new Long(322649), c1.get("id"));        assertEquals(new Long(322649), c1_repl.get("id"));        assertEquals("biking", c1.get("hobbies"));        assertEquals("biking", c1_repl.get("hobbies"));        assertEquals("Centurion", c1.get("bike"));        assertEquals("Centurion", c1_repl.get("bike"));        // Now see what happens if we reconnect the first channel        // But first, add another MuxChannel on that JChannel        // just so it remains coordinator (test that it doesn't        // ask for state from itself)        ch2=factory.createMultiplexerChannel(STACK_NAME, "c2");        assertTrue(ch2.isOpen());        assertFalse(ch2.isConnected());        assertServiceAndClusterView(ch1, 2, 2);        assertServiceAndClusterView(ch1_repl, 2, 2);        ch1.disconnect();        assertTrue(ch1.isOpen());        assertFalse(ch1.isConnected());        assertServiceAndClusterView(ch1_repl, 1, 1);        assertTrue(ch2.isOpen());        assertFalse(ch2.isConnected());        c1.clear();        ch1.connect("bla");        assertTrue(ch1.isOpen());        assertTrue(ch1.isConnected());        assertServiceAndClusterView(ch1, 2, 2);        assertServiceAndClusterView(ch1_repl, 2, 2);        assertTrue(ch2.isOpen());        assertFalse(ch2.isConnected());        assertEquals("cache has to be empty initially", 0, c1.size());        rc=ch1.getState(null, 5000);        System.out.println("state transfer: " + rc);        Util.sleep(500);        System.out.println("c1: " + c1);        assertEquals("initial state should have been transferred", 4, c1.size());        assertEquals(new Long(322649), c1.get("id"));        assertEquals(new Long(322649), c1_repl.get("id"));        assertEquals("biking", c1.get("hobbies"));        assertEquals("biking", c1_repl.get("hobbies"));        assertEquals("Centurion", c1.get("bike"));        assertEquals("Centurion", c1_repl.get("bike"));    }