use of io.crnk.client.http.okhttp.OkHttpAdapter in project crnk-framework by crnk-project.
the class HttpAdapterProviderTest method testOkHttpProvider.
@Test
public void testOkHttpProvider() {
OkHttpAdapterProvider provider = new OkHttpAdapterProvider();
Assert.assertTrue(provider.isAvailable());
Assert.assertTrue(provider.newInstance() instanceof OkHttpAdapter);
}
use of io.crnk.client.http.okhttp.OkHttpAdapter in project crnk-framework by crnk-project.
the class OkHttpAdapterTest method testCannotAddListenersAfterInitialization.
@Test
public void testCannotAddListenersAfterInitialization() {
OkHttpAdapter adapter = new OkHttpAdapter();
adapter.getImplementation();
try {
adapter.addListener(Mockito.mock(OkHttpAdapterListener.class));
Assert.fail();
} catch (IllegalStateException e) {
// ok
}
}
use of io.crnk.client.http.okhttp.OkHttpAdapter in project crnk-framework by crnk-project.
the class OkHttpAdapterTest method testCannotSetTimeoutAfterInitialization.
@Test
public void testCannotSetTimeoutAfterInitialization() {
OkHttpAdapter adapter = new OkHttpAdapter();
adapter.getImplementation();
try {
adapter.setReceiveTimeout(0, TimeUnit.DAYS);
Assert.fail();
} catch (IllegalStateException e) {
// ok
}
}
use of io.crnk.client.http.okhttp.OkHttpAdapter 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);
}
});
}
Aggregations