@Test
    public void connectionTest() throws Exception {
        Connection conn = client.createStandaloneConnection(ip, port, 1000);
        Thread.sleep(100);
        Assert.assertTrue(conn.isFine());
        Assert.assertTrue(serverConnectProcessor.isConnected());
        Assert.assertEquals(1, clientConnectProcessor.getConnectTimes());
        Assert.assertEquals(1, serverConnectProcessor.getConnectTimes());
        client.closeStandaloneConnection(conn);
        Thread.sleep(100);
        Assert.assertTrue(!conn.isFine());
        Assert.assertTrue(serverDisConnectProcessor.isDisConnected());
        Assert.assertEquals(1, clientDisConnectProcessor.getDisConnectTimes());
        Assert.assertEquals(1, serverDisConnectProcessor.getDisConnectTimes());

        conn = client.createStandaloneConnection(ip, port, 1000);
        Thread.sleep(100);
        Assert.assertTrue(conn.isFine());
        Assert.assertEquals(2, clientConnectProcessor.getConnectTimes());
        Assert.assertEquals(2, serverConnectProcessor.getConnectTimes());
        client.closeStandaloneConnection(conn);
        Thread.sleep(100);
        Assert.assertTrue(!conn.isFine());
        Assert.assertEquals(2, clientDisConnectProcessor.getDisConnectTimes());
        Assert.assertEquals(2, serverDisConnectProcessor.getDisConnectTimes());

        conn = client.createStandaloneConnection(ip, port, 1000);
        Thread.sleep(100);
        Assert.assertTrue(conn.isFine());
        Assert.assertEquals(3, clientConnectProcessor.getConnectTimes());
        Assert.assertEquals(3, serverConnectProcessor.getConnectTimes());
        client.closeStandaloneConnection(conn);
        Thread.sleep(100);
        Assert.assertTrue(!conn.isFine());
        Assert.assertEquals(3, clientDisConnectProcessor.getDisConnectTimes());
        Assert.assertEquals(3, serverDisConnectProcessor.getDisConnectTimes());
        Thread.sleep(100);
        Assert.assertEquals(3, serverConnectProcessor.getConnectTimes());
    }
Connection test

@author jiangping
@version $Id: ConnectionTest.java, v 0.1 Mar 6, 2016 9:55:50 PM tao Exp $
src/test/java/com/alipay/remoting/inner/connection/ConnectionTest.java