Search in sources :

Example 1 with HTTPClientBuilder

use of core.framework.http.HTTPClientBuilder in project core-ng-project by neowu.

the class APIConfig method httpClient.

private HTTPClient httpClient() {
    if (state.httpClient == null) {
        HTTPClient httpClient = new HTTPClientBuilder().userAgent("APIClient").timeout(state.timeout).slowOperationThreshold(state.slowOperationThreshold).build();
        context.shutdownHook.add(httpClient::close);
        state.httpClient = httpClient;
    }
    return state.httpClient;
}
Also used : HTTPClientBuilder(core.framework.http.HTTPClientBuilder) HTTPClient(core.framework.http.HTTPClient)

Example 2 with HTTPClientBuilder

use of core.framework.http.HTTPClientBuilder in project core-ng-project by neowu.

the class TestModule method initialize.

@Override
protected void initialize() {
    loadProperties("test.properties");
    // in test context, override binding is defined before actual binding
    overrideBinding(HTTPClient.class, Mockito.mock(HTTPClient.class));
    bind(HTTPClient.class, new HTTPClientBuilder().build());
    configureDB();
    configureMongo();
    configureSearch();
    configureKafka();
    redis().host("localhost");
    log().writeToConsole();
    site().session().redis("localhost");
    configureHTTP();
    bind(new TestBean(requiredProperty("test.inject-test.property")));
}
Also used : TestBean(core.framework.test.inject.TestBean) HTTPClientBuilder(core.framework.http.HTTPClientBuilder) HTTPClient(core.framework.http.HTTPClient)

Aggregations

HTTPClient (core.framework.http.HTTPClient)2 HTTPClientBuilder (core.framework.http.HTTPClientBuilder)2 TestBean (core.framework.test.inject.TestBean)1