@Override
    public ClientTransport getClientTransport(ClientTransportConfig config) {

        ClientTransport transport = allTransports.get(config);
        if (transport == null) {
            transport = ExtensionLoaderFactory.getExtensionLoader(ClientTransport.class)
                .getExtension(config.getContainer(),
                    new Class[] { ClientTransportConfig.class },
                    new Object[] { config });
            ClientTransport old = allTransports.putIfAbsent(config, transport); // 保存唯一长连接
            if (old != null) {
                if (LOGGER.isWarnEnabled()) {
                    LOGGER.warn("Multiple threads init ClientTransport with same ClientTransportConfig!");
                }
                transport.destroy(); //如果同时有人插入，则使用第一个
                transport = old;
            }
        }
        return transport;
    }
@Test
    public void getClientTransport() {
        NotReusableClientTransportHolder holder = new NotReusableClientTransportHolder();
        ClientTransportConfig config = new ClientTransportConfig();
        config.setProviderInfo(new ProviderInfo().setHost("127.0.0.1").setPort(12222))
            .setContainer("test");

        TestClientTransport clientTransport = (TestClientTransport) holder.getClientTransport(config);

        ClientTransportConfig config2 = new ClientTransportConfig();
        config2.setProviderInfo(new ProviderInfo().setHost("127.0.0.1").setPort(12222))
            .setContainer("test");
        TestClientTransport clientTransport2 = (TestClientTransport) holder.getClientTransport(config2);
        Assert.assertFalse(clientTransport == clientTransport2);

        ClientTransportConfig config3 = new ClientTransportConfig();
        config3.setProviderInfo(new ProviderInfo().setHost("127.0.0.1").setPort(12223))
            .setContainer("test");
        TestClientTransport clientTransport3 = (TestClientTransport) holder.getClientTransport(config3);
        Assert.assertFalse(clientTransport2 == clientTransport3);

        Assert.assertFalse(holder.removeClientTransport(null));

        clientTransport.setRequest(4);
        Assert.assertTrue(holder.removeClientTransport(clientTransport));
        Assert.assertEquals(2, holder.size());

        clientTransport2.setRequest(0);
        Assert.assertTrue(holder.removeClientTransport(clientTransport2));
        Assert.assertEquals(1, holder.size());

        holder.destroy();
        Assert.assertEquals(0, holder.size());
    }