import org.asynchttpclient.AsyncHttpClient; import org.asynchttpclient.DefaultAsyncHttpClient; import org.asynchttpclient.Response; public class AHCClientExample { public static void main(String[] args) throws Exception { try (AsyncHttpClient client = new DefaultAsyncHttpClient()) { client.prepareGet("https://example.com/") .execute() .toCompletableFuture() .thenApply(Response::getResponseBody) .thenAccept(System.out::println) .join(); } } }


上一篇:
下一篇:
切换中文