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 asyncHttpClient = new DefaultAsyncHttpClient()) {
asyncHttpClient
.prepareGet("https://api.example.com/resource")
.execute()
.toCompletableFuture()
.thenAccept(response -> {
System.out.println("Status code: " + response.getStatusCode());
System.out.println("Response body: " + response.getResponseBody());
})
.join();
}
}
}