Search in sources :

Example 1 with OkHttpAdapterListenerBase

use of io.crnk.client.http.okhttp.OkHttpAdapterListenerBase in project crnk-framework by crnk-project.

the class AbstractMetaJerseyTest method setNetworkTimeout.

public static void setNetworkTimeout(CrnkClient client, final int timeout, final TimeUnit timeUnit) {
    OkHttpAdapter httpAdapter = (OkHttpAdapter) client.getHttpAdapter();
    httpAdapter.addListener(new OkHttpAdapterListenerBase() {

        @Override
        public void onBuild(Builder builder) {
            builder.readTimeout(timeout, timeUnit);
        }
    });
}
Also used : Builder(okhttp3.OkHttpClient.Builder) OkHttpAdapter(io.crnk.client.http.okhttp.OkHttpAdapter) OkHttpAdapterListenerBase(io.crnk.client.http.okhttp.OkHttpAdapterListenerBase)

Example 2 with OkHttpAdapterListenerBase

use of io.crnk.client.http.okhttp.OkHttpAdapterListenerBase in project crnk-framework by crnk-project.

the class AbstractJpaJerseyTest method setNetworkTimeout.

public static void setNetworkTimeout(CrnkClient client, final int timeout, final TimeUnit timeUnit) {
    OkHttpAdapter httpAdapter = (OkHttpAdapter) client.getHttpAdapter();
    httpAdapter.addListener(new OkHttpAdapterListenerBase() {

        @Override
        public void onBuild(Builder builder) {
            builder.readTimeout(timeout, timeUnit);
        }
    });
}
Also used : QueryParamsBuilder(io.crnk.legacy.queryParams.QueryParamsBuilder) Builder(okhttp3.OkHttpClient.Builder) OkHttpAdapter(io.crnk.client.http.okhttp.OkHttpAdapter) OkHttpAdapterListenerBase(io.crnk.client.http.okhttp.OkHttpAdapterListenerBase)

Example 3 with OkHttpAdapterListenerBase

use of io.crnk.client.http.okhttp.OkHttpAdapterListenerBase in project crnk-framework by crnk-project.

the class SecurityModuleIntTest method setBasicAuthentication.

private static void setBasicAuthentication(CrnkClient client, final String userName, final String password) {
    OkHttpAdapter httpAdapter = (OkHttpAdapter) client.getHttpAdapter();
    httpAdapter.addListener(new OkHttpAdapterListenerBase() {

        @Override
        public void onBuild(OkHttpClient.Builder builder) {
            builder.authenticator(new TestAuthenticator(userName, password));
        }
    });
}
Also used : OkHttpClient(okhttp3.OkHttpClient) OkHttpAdapter(io.crnk.client.http.okhttp.OkHttpAdapter) OkHttpAdapterListenerBase(io.crnk.client.http.okhttp.OkHttpAdapterListenerBase)

Example 4 with OkHttpAdapterListenerBase

use of io.crnk.client.http.okhttp.OkHttpAdapterListenerBase in project crnk-framework by crnk-project.

the class OkHttpClientTest method setupClient.

@Override
protected void setupClient(CrnkClient client) {
    super.setupClient(client);
    listener = Mockito.mock(OkHttpAdapterListener.class);
    OkHttpAdapter httpAdapter = OkHttpAdapter.newInstance();
    httpAdapter.addListener(new OkHttpAdapterListenerBase());
    httpAdapter.addListener(listener);
    client.setHttpAdapter(httpAdapter);
}
Also used : OkHttpAdapterListener(io.crnk.client.http.okhttp.OkHttpAdapterListener) OkHttpAdapter(io.crnk.client.http.okhttp.OkHttpAdapter) OkHttpAdapterListenerBase(io.crnk.client.http.okhttp.OkHttpAdapterListenerBase)

Example 5 with OkHttpAdapterListenerBase

use of io.crnk.client.http.okhttp.OkHttpAdapterListenerBase in project crnk-framework by crnk-project.

the class AbstractOperationsTest method setNetworkTimeout.

public static void setNetworkTimeout(CrnkClient client, final int timeout, final TimeUnit timeUnit) {
    OkHttpAdapter httpAdapter = (OkHttpAdapter) client.getHttpAdapter();
    httpAdapter.addListener(new OkHttpAdapterListenerBase() {

        @Override
        public void onBuild(Builder builder) {
            builder.readTimeout(timeout, timeUnit);
        }
    });
}
Also used : Builder(okhttp3.OkHttpClient.Builder) OkHttpAdapter(io.crnk.client.http.okhttp.OkHttpAdapter) OkHttpAdapterListenerBase(io.crnk.client.http.okhttp.OkHttpAdapterListenerBase)

Aggregations

OkHttpAdapter (io.crnk.client.http.okhttp.OkHttpAdapter)5 OkHttpAdapterListenerBase (io.crnk.client.http.okhttp.OkHttpAdapterListenerBase)5 Builder (okhttp3.OkHttpClient.Builder)3 OkHttpAdapterListener (io.crnk.client.http.okhttp.OkHttpAdapterListener)1 QueryParamsBuilder (io.crnk.legacy.queryParams.QueryParamsBuilder)1 OkHttpClient (okhttp3.OkHttpClient)1