Example usage for org.apache.http.params HttpParams getLongParameter

List of usage examples for org.apache.http.params HttpParams getLongParameter

Introduction

In this page you can find the example usage for org.apache.http.params HttpParams getLongParameter.

Prototype

long getLongParameter(String str, long j);

Source Link

Usage

From source file:hornet.framework.technical.HTTPClientParameterBuilderTest.java

/**
 * Teste la mthode <tt>loadHttpParamToHttpClientFromConfig</tt> pour le cas o le paramtrage par dfaut
 * est dfini.//from  w w  w . ja v  a  2s  .com
 */
@SuppressWarnings("unchecked")
@Test
public void testLoadHttpParamToHttpClientShouldLoadDefaultValue() {

    final HttpClient httpClient = new DefaultHttpClient();

    HTTPClientParameterBuilder.loadHttpParamToHttpClientFromConfig(httpClient, null);

    final HttpParams httpParams = httpClient.getParams();

    assertEquals(CONST_3000, httpParams.getIntParameter("http.connection.timeout", 0));
    final Map<HttpHost, Integer> maxPerHost = (Map<HttpHost, Integer>) httpParams
            .getParameter("http.connection-manager.max-per-host");
    assertEquals(1, maxPerHost.size());
    assertTrue(maxPerHost.containsKey(new HttpHost("hostname")));
    assertEquals(Integer.valueOf(CONST_50), maxPerHost.get(new HttpHost("hostname")));
    assertEquals(CONST_50, httpParams.getIntParameter("http.connection-manager.max-total", 0));
    assertEquals(CONST_3000, httpParams.getLongParameter("http.connection-manager.timeout", 0));
    assertEquals(CONST_60000, httpParams.getIntParameter("http.socket.timeout", 0));
    assertEquals(org.apache.http.impl.conn.PoolingHttpClientConnectionManager.class,
            httpParams.getParameter("http.connection-manager.class"));
}