use of io.crnk.client.http.okhttp.OkHttpAdapter 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);
}
});
}
use of io.crnk.client.http.okhttp.OkHttpAdapter 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));
}
});
}
use of io.crnk.client.http.okhttp.OkHttpAdapter 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);
}
use of io.crnk.client.http.okhttp.OkHttpAdapter in project crnk-framework by crnk-project.
the class ModuleClientTest method testReconfigureHttpAdapter.
@Test
public void testReconfigureHttpAdapter() {
OkHttpAdapter newAdapter = new OkHttpAdapter();
client.setHttpAdapter(newAdapter);
Mockito.verify(testModule, Mockito.times(1)).setHttpAdapter(newAdapter);
}
use of io.crnk.client.http.okhttp.OkHttpAdapter in project crnk-framework by crnk-project.
the class ModuleClientTest method setup.
@Before
public void setup() {
super.setup();
client.setHttpAdapter(new OkHttpAdapter());
client.addModule(testModule);
}
Aggregations