Search in sources :

Example 6 with HttpClientAdapter

use of io.crnk.client.http.apache.HttpClientAdapter in project crnk-framework by crnk-project.

the class HttpClientAdapterTest method testCannotAddListenersAfterInitialization.

@Test
public void testCannotAddListenersAfterInitialization() {
    HttpClientAdapter adapter = new HttpClientAdapter();
    adapter.getImplementation();
    try {
        adapter.addListener(Mockito.mock(HttpClientAdapterListener.class));
        Assert.fail();
    } catch (IllegalStateException e) {
    // ok
    }
}
Also used : HttpClientAdapter(io.crnk.client.http.apache.HttpClientAdapter) HttpClientAdapterListener(io.crnk.client.http.apache.HttpClientAdapterListener) Test(org.junit.Test)

Example 7 with HttpClientAdapter

use of io.crnk.client.http.apache.HttpClientAdapter in project crnk-framework by crnk-project.

the class HttpAdapterProviderTest method testHttpClientProvider.

@Test
public void testHttpClientProvider() {
    HttpClientAdapterProvider provider = new HttpClientAdapterProvider();
    Assert.assertTrue(provider.isAvailable());
    Assert.assertTrue(provider.newInstance() instanceof HttpClientAdapter);
}
Also used : HttpClientAdapter(io.crnk.client.http.apache.HttpClientAdapter) HttpClientAdapterProvider(io.crnk.client.http.apache.HttpClientAdapterProvider) AbstractClientTest(io.crnk.client.AbstractClientTest) Test(org.junit.Test)

Aggregations

HttpClientAdapter (io.crnk.client.http.apache.HttpClientAdapter)7 HttpClientAdapterListener (io.crnk.client.http.apache.HttpClientAdapterListener)4 OkHttpAdapter (io.crnk.client.http.okhttp.OkHttpAdapter)3 Test (org.junit.Test)3 OkHttpAdapterListener (io.crnk.client.http.okhttp.OkHttpAdapterListener)2 HttpTracing (brave.http.HttpTracing)1 AbstractClientTest (io.crnk.client.AbstractClientTest)1 HttpClientAdapterListenerBase (io.crnk.client.http.apache.HttpClientAdapterListenerBase)1 HttpClientAdapterProvider (io.crnk.client.http.apache.HttpClientAdapterProvider)1 QuerySpec (io.crnk.core.queryspec.QuerySpec)1 HttpClientBraveIntegration (io.crnk.monitor.brave.internal.HttpClientBraveIntegration)1 OkHttpBraveIntegration (io.crnk.monitor.brave.internal.OkHttpBraveIntegration)1 Task (io.crnk.test.mock.models.Task)1 Constructor (java.lang.reflect.Constructor)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Interceptor (okhttp3.Interceptor)1 OkHttpClient (okhttp3.OkHttpClient)1 Response (okhttp3.Response)1 Header (org.apache.http.Header)1 HttpRequest (org.apache.http.HttpRequest)1