@Test
    public void testLazyFailWhenMultipleThreads() {

        ConsumerConfig<HelloService> consumerConfig = new ConsumerConfig<HelloService>()
            .setInterfaceId(HelloService.class.getName())
            .setDirectUrl("bolt://127.0.0.1:22223")
            .setTimeout(1000)
            .setLazy(true)
            .setRepeatedReferLimit(-1)
            .setRegister(false);
        final HelloService helloService = consumerConfig.refer();

        int threads = 10;
        final AtomicInteger count1 = new AtomicInteger();
        final CountDownLatch latch = new CountDownLatch(threads);
        for (int i = 0; i < threads; i++) {
            try {
                Thread thread = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        for (int j = 0; j < 10; j++) {
                            try {
                                helloService.sayHello("xxx", 20);
                                count1.incrementAndGet();
                            } catch (Exception ignore) {
                            }
                        }
                        latch.countDown();
                    }
                }, "thread" + i);
                thread.start();

            } catch (Exception ignore) {
            }
        }
        try {
            latch.await(3000, TimeUnit.MILLISECONDS);
        } catch (Exception e) {

        }
        Assert.assertEquals(count1.get(), 0);
    }
@author <a href="mailto:zhanggeng.zg@antfin.com">GengZhang</a>
test/test-integration/src/test/java/com/alipay/sofa/rpc/test/client/LazyConnectTest.java