import org.glassfish.grizzly.http.client.*;
public class GrizzlyAsyncHttpClientExample {
public static void main(String[] args) {
try {
final AsyncHttpClient client = new AsyncHttpClient();
final Future<Response> future = client.prepareGet("https://example.com").execute();
future.addListener(new FutureListener<Response>() {
public void onSuccess(Response response) {
System.out.println(response.getResponseBodyExcerpt(1000));
}
public void onFailure(Throwable throwable) {
throwable.printStackTrace();
}
});
future.get();
client.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}