### Question:
AsyncHttpClient implements Closeable { public ListenableFuture<HttpResponse> execute(HttpRequest request, String path, Object... urlVariables) throws IOException { SettableFuture<HttpResponse> response = SettableFuture.create(); executor.submit(new ExecuteTask(response, request, path, urlVariables, janus, httpClient, executor, numRetries)); return response; } AsyncHttpClient(Janus janus, int numRetries); void close(); ListenableFuture<HttpResponse> execute(HttpRequest request, String path, Object... urlVariables);  }### Answer:
@Test public void testGet() throws Exception { Janus janus = new Janus( VIP_TEST, new ConstServerList(VIP_TEST, "http: new RandomLoadBalancer(), new ServerStatsFactory(ServerStats.class, new MetricRegistry())); try (AsyncHttpClient client = new AsyncHttpClient(janus, 0)) { ListenableFuture<HttpResponse> responseFuture = client.execute(new HttpRequest(HttpMethod.GET, null, null), "/"); HttpResponse response = responseFuture.get(5, TimeUnit.SECONDS); Assert.assertNotNull(response); } }
@Test public void testPost() throws Exception { final byte[] sentData = RandomStringUtils.randomAscii(32).getBytes(Charsets.US_ASCII); Janus janus = new Janus( VIP_TEST, new ConstServerList(VIP_TEST, "http: new RandomLoadBalancer(), new ServerStatsFactory(ServerStats.class, new MetricRegistry())); try (AsyncHttpClient client = new AsyncHttpClient(janus, 0)) { ListenableFuture<HttpResponse> responseFuture = client.execute(new HttpRequest(HttpMethod.POST, null, new ByteArrayInputStream(sentData)), "/"); HttpResponse response = responseFuture.get(5, TimeUnit.SECONDS); Assert.assertNotNull(response); Assert.assertEquals(new String(sentData, Charsets.US_ASCII).trim(), new String(IOUtils.toByteArray(response.getBody()), Charsets.US_ASCII).trim()); } }