Example usage for org.apache.http.client.benchmark TestHttpClient3 TestHttpClient3

List of usage examples for org.apache.http.client.benchmark TestHttpClient3 TestHttpClient3

Introduction

In this page you can find the example usage for org.apache.http.client.benchmark TestHttpClient3 TestHttpClient3.

Prototype

public TestHttpClient3() 

Source Link

Usage

From source file:org.apache.http.client.benchmark.TestHttpClient3.java

public static void main(String[] args) throws Exception {
    if (args.length < 2) {
        System.out.println("Usage: <target URI> <no of requests> <concurrent connections>");
        System.exit(-1);/*from  w  w  w  . j  a  v  a  2 s . c o  m*/
    }
    URI targetURI = new URI(args[0]);
    int n = Integer.parseInt(args[1]);
    int c = 1;
    if (args.length > 2) {
        c = Integer.parseInt(args[2]);
    }

    TestHttpClient3 test = new TestHttpClient3();
    test.init();
    try {
        long startTime = System.currentTimeMillis();
        Stats stats = test.get(targetURI, n, c);
        long finishTime = System.currentTimeMillis();

        Stats.printStats(targetURI, startTime, finishTime, stats);
    } finally {
        test.shutdown();
    }
}