Package com.codahale.metrics.httpclient

Examples of com.codahale.metrics.httpclient.InstrumentedHttpClientConnectionManager


     *
     * @param name
     * @return an {@link CloseableHttpClient}
     */
    public CloseableHttpClient build(String name) {
        final InstrumentedHttpClientConnectionManager manager = createConnectionManager(registry, name);
        return createClient(org.apache.http.impl.client.HttpClientBuilder.create(), manager, name);
    }
View Full Code Here


     * @return a InstrumentedHttpClientConnectionManger instance
     */
    protected InstrumentedHttpClientConnectionManager createConnectionManager(Registry<ConnectionSocketFactory> registry,
                                                                              String name) {
        final Duration ttl = configuration.getTimeToLive();
        final InstrumentedHttpClientConnectionManager manager = new InstrumentedHttpClientConnectionManager(
                metricRegistry,
                registry,
                null, null,
                resolver,
                ttl.getQuantity(),
View Full Code Here

    @Before
    public void setUp() {
        final MetricRegistry metricRegistry = new MetricRegistry();
        configuration = new HttpClientConfiguration();
        builder = new HttpClientBuilder(metricRegistry);
        connectionManager = spy(new InstrumentedHttpClientConnectionManager(metricRegistry, registry));
        apacheBuilder = org.apache.http.impl.client.HttpClientBuilder.create();

        initMocks(this);
    }
View Full Code Here

    }

    @Test
    public void canUseACustomDnsResolver() throws Exception {
        final DnsResolver resolver = mock(DnsResolver.class);
        final InstrumentedHttpClientConnectionManager manager =
                builder.using(resolver).createConnectionManager(registry, "test");

        // Yes, this is gross. Thanks, Apache!
        final Field connectionOperatorField =
                FieldUtils.getField(PoolingHttpClientConnectionManager.class, "connectionOperator", true);
View Full Code Here

    }


    @Test
    public void usesASystemDnsResolverByDefault() throws Exception {
        final InstrumentedHttpClientConnectionManager manager = builder.createConnectionManager(registry, "test");

        // Yes, this is gross. Thanks, Apache!
        final Field connectionOperatorField =
                FieldUtils.getField(PoolingHttpClientConnectionManager.class, "connectionOperator", true);
        final Object connectOperator = connectionOperatorField.get(manager);
View Full Code Here

TOP

Related Classes of com.codahale.metrics.httpclient.InstrumentedHttpClientConnectionManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.