package com.google.code.http4j.example;
import java.io.IOException;
import java.net.URISyntaxException;
import com.google.code.http4j.Client;
import com.google.code.http4j.Response;
import com.google.code.http4j.impl.BasicClient;
import com.google.code.http4j.utils.Metrics;
public class BasicExample {
public static void main(String[] args) throws Exception {
Client client = new BasicClient();
Response response = client.get("http://code.google.com/p/http4j/");
Metrics metrics = response.getMetrics();
System.out.println("Bytes sent:" + metrics.getBytesSent());
System.out.println("Bytes received:" + metrics.getBytesReceived());
System.out.println("Blocking cost:" + metrics.getBlockingCost());
System.out.println("DNS lookup cost:" + metrics.getDnsLookupCost());
System.out.println("Connection establish cost:" + metrics.getConnectingCost());
System.out.println("Sending cost:" + metrics.getSendingCost());
System.out.println("Waiting cost:" + metrics.getWaitingCost());
System.out.println("Receiving cost:" + metrics.getReceivingCost());
System.out.println("SSL handshake cost:" + metrics.getSslHandshakeCost());
response.output(System.out);
client.shutdown();
}
}