public class Test{
public static void main(String args[]){
ALPN.debug = true;
HTTP2Client http2Client = new HTTP2Client();
http2Client.start();
SslContextFactory ssl = new SslContextFactory(true);
ssl.setKeyStore(getKeyStore());
ssl.setKeyStorePassword("");
HttpClient client = new HttpClient(new HttpClientTransportOverHTTP2(http2Client), ssl);
System.out.println("-----Max request per destination"
+ client.getMaxRequestsQueuedPerDestination());
System.out.println("client.getMaxRequestsQueuedPerDestination()"
+ client.getMaxRequestsQueuedPerDestination());
client.start();
long start =System.currentTimeMillis();
req.send(new ResponseListener(i));
}
}
//Response is handled asynchronously.
public class ResponseListener extends BufferingResponseListener{
int id = 0;
int j = 0;
private String threadName;
public ResponseListener(int i) {
super();
id = i;
}
@Override
public void onComplete(Result result) {
try {
Response response = result.getResponse();
//System.out.println("Response .." + response);
int status = response.getStatus();
if (status == 200) {
System.out.println("ID-" + id + ",Success");
}
else {
System.out.println("ID-" + id + ",Failure. status code " + status + ", response"
+ getContentAsString());
}
}
catch (Throwable t) {
t.printStackTrace();
}
}
}