List of usage examples for org.apache.commons.httpclient HttpClient getPort
public int getPort()
From source file:org.geowebcache.layer.wms.HttpClientTest.java
/** * Some numbers just for creating HttpClient instances * (less than what is done below)/*from w ww . j ava 2s. c o m*/ * * Core i7 , Java 1.6 values: * 1 000 000 in 559 ms * 1 00 000 in 267 ms * 10 000 in 186 ms * 1 000 in 134 ms * * @throws Exception */ public void testHttpClientConstruction() throws Exception { if (RUN_PERFORMANCE_TEST) { long start = System.currentTimeMillis(); for (int i = 0; i < LOOP_COUNT; i++) { HttpClient hc = new HttpClient(); URL url = new URL("http://localhost:8080/test"); GetMethod getMethod = new GetMethod(url.toString()); AuthScope authscope = new AuthScope(url.getHost(), url.getPort()); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("username", "password"); hc.getState().setCredentials(authscope, credentials); getMethod.setDoAuthentication(true); hc.getParams().setAuthenticationPreemptive(true); if (hc.getPort() == 0) { // Dummy } //System.out.print(i); } long stop = System.currentTimeMillis(); long diff = (stop - start); System.out.println("Time to create " + LOOP_COUNT + " in " + diff + " milliseconds"); } }