@Override
    public void init(final DiscoveryConfig config) {
        try {
            if (this.etcdClient != null) {
                return;
            }
            Properties props = config.getProps();
            this.timeout = Long.parseLong(props.getProperty("etcdTimeout", "3000"));
            this.ttl = Long.parseLong(props.getProperty("etcdTTL", "5"));
            this.etcdClient = Client.builder().endpoints(config.getServerList().split(",")).build();
            LOGGER.info("Etcd Discovery Service initialize successfully");
            if (leaseId == 0) {
                initLease();
            }
        } catch (Exception e) {
            LOGGER.error("Error initializing Etcd Discovery Service", e);
            throw new ShenyuException(e);
        }
    }
@Test
    public void testInit() throws ExecutionException, InterruptedException, NoSuchFieldException, IllegalAccessException {
        setField(EtcdDiscoveryService.class, "etcdClient", null);
        final ClientBuilder builder = mock(ClientBuilder.class);
        when(builder.endpoints(anyString())).thenReturn(builder);
        when(builder.build()).thenReturn(etcdClient);
        final MockedStatic<Client> client = mockStatic(Client.class);
        client.when(Client::builder).thenReturn(builder);

        final Lease lease = mock(Lease.class);
        final CompletableFuture<LeaseGrantResponse> leaseGrantFuture = mock(CompletableFuture.class);
        when(lease.grant(anyLong())).thenReturn(leaseGrantFuture);
        final LeaseGrantResponse leaseGrantResponse = mock(LeaseGrantResponse.class);
        when(leaseGrantFuture.get()).thenReturn(leaseGrantResponse);
        when(etcdClient.getLeaseClient()).thenReturn(lease);

        ArrayList<StreamObserver<LeaseKeepAliveResponse>> observerList = new ArrayList<>();
        doAnswer(invocationOnMock -> {
            observerList.add(invocationOnMock.getArgument(1));
            return lease;
        }).when(lease).keepAlive(anyLong(), any());

        final Properties props = new Properties();
        props.put("etcdTimeout", "3000");
        props.put("etcdTTL", "5");
        final DiscoveryConfig discoveryConfig = new DiscoveryConfig();
        discoveryConfig.setProps(props);
        discoveryConfig.setServerList("localhost:2379");
        etcdDiscoveryServiceUnderTest.init(discoveryConfig);
        final LeaseKeepAliveResponse leaseKeepAliveResponse = mock(LeaseKeepAliveResponse.class);

        observerList.forEach(observer -> {
            observer.onNext(leaseKeepAliveResponse);
            observer.onError(new ShenyuException("test"));
            observer.onCompleted();
        });

        doThrow(new InterruptedException("test")).when(leaseGrantFuture).get();
        assertDoesNotThrow(() -> etcdDiscoveryServiceUnderTest.init(discoveryConfig));
    }