HttpDiscoveryAnnouncementClient implements DiscoveryAnnouncementClient { @Override public ListenableFuture<Void> unannounce() { Request request = prepareDelete() .setUri(URI.create("v1/announcement/" + nodeInfo.getNodeId())) .setHeader("User-Agent", nodeInfo.getNodeId()) .build(); return httpClient.executeAsync(request, new DiscoveryResponseHandler<>("Unannouncement")); } @Inject  HttpDiscoveryAnnouncementClient(NodeInfo nodeInfo,
            JsonCodec<Announcement> announcementCodec,
            @ForDiscoveryClient HttpClient httpClient); @Override ListenableFuture<Duration> announce(Set<ServiceAnnouncement> services); @Override ListenableFuture<Void> unannounce();  }
@Test public void testUnannounce() throws Exception { httpClient.setProcessor((request -> { assertEquals(request.getMethod(), "DELETE"); assertEquals(request.getUri(), URI.create("v1/announcement/" + nodeInfo.getNodeId())); assertEquals(request.getHeader("User-Agent"), nodeInfo.getNodeId()); return mockResponse(NOT_FOUND); })); client.unannounce().get(); assertEquals(httpClient.getRequestCount(), 1); }