@Override
    public void unregister(InetSocketAddress address) {
        // stop heartbeat

        if (heartBeatScheduledFuture != null && !heartBeatScheduledFuture.isCancelled()) {
            heartBeatScheduledFuture.cancel(true);
        }
        NetUtil.validAddress(address);
        Instance instance = Instance.getInstance();
        instance.setTransaction(new Node.Endpoint(address.getAddress().getHostAddress(), address.getPort(), "netty"));
        for (String urlSuffix : getNamingAddrs()) {
            String url = HTTP_PREFIX + urlSuffix + "/naming/v1/unregister?";
            String unit = instance.getUnit();
            String jsonBody = instance.toJsonString();
            String params = "unit=" + unit;
            params = params + "&cluster=" + instance.getClusterName();
            params = params + "&namespace=" + instance.getNamespace();
            url += params;
            Map<String, String> header = new HashMap<>();
            header.put(HTTP.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());
            try (CloseableHttpResponse response = HttpClientUtil.doPost(url, jsonBody, header, 3000)) {
                int statusCode = response.getStatusLine().getStatusCode();
                if (statusCode == 200) {
                    LOGGER.info("instance has been unregistered successfully:{}", statusCode);
                } else {
                    LOGGER.warn("instance has been unregistered unsuccessfully:{}", statusCode);
                }
            } catch (Exception e) {
                LOGGER.error("instance has been unregistered failed in namingserver {}", url, e);
            }
        }
    }
@Test
    public void testUnregister() throws Exception {
        RegistryService registryService = new NamingserverRegistryProvider().provide();
        InetSocketAddress inetSocketAddress1 = new InetSocketAddress("127.0.0.1", 8088);
        //1.register
        registryService.register(inetSocketAddress1);

        //2.create vGroup in cluster
        String namespace = FILE_CONFIG.getConfig("registry.namingserver.namespace");
        createGroupInCluster(namespace, "group1", "cluster1");

        //3.get instances
        List list = registryService.lookup("group1");

        assertEquals(list.size(), 1);

        //4.unregister
        registryService.unregister(inetSocketAddress1);

        //5.get instances
        List list1 = registryService.lookup("group1");
        assertEquals(list1.size(), 0);

    }