use of com.auth0.client.HttpOptions in project auth0-java by auth0.
the class ManagementAPITest method shouldUseZeroIfNegativeTimeoutConfigured.
@Test
public void shouldUseZeroIfNegativeTimeoutConfigured() {
HttpOptions options = new HttpOptions();
options.setConnectTimeout(-1);
options.setReadTimeout(-1);
ManagementAPI api = new ManagementAPI(DOMAIN, API_TOKEN, options);
assertThat(api.getClient().connectTimeoutMillis(), is(0));
assertThat(api.getClient().readTimeoutMillis(), is(0));
}
use of com.auth0.client.HttpOptions in project auth0-java by auth0.
the class ManagementAPITest method shouldUseConfiguredMaxRequestsPerHost.
@Test
public void shouldUseConfiguredMaxRequestsPerHost() {
HttpOptions options = new HttpOptions();
options.setMaxRequestsPerHost(10);
ManagementAPI api = new ManagementAPI(DOMAIN, API_TOKEN, options);
assertThat(api.getClient().dispatcher().getMaxRequestsPerHost(), is(10));
}
use of com.auth0.client.HttpOptions in project auth0-java by auth0.
the class ManagementAPITest method shouldConfigureBasicLoggingFromOptions.
@Test
public void shouldConfigureBasicLoggingFromOptions() {
LoggingOptions loggingOptions = new LoggingOptions(LoggingOptions.LogLevel.BASIC);
HttpOptions options = new HttpOptions();
options.setLoggingOptions(loggingOptions);
ManagementAPI api = new ManagementAPI(DOMAIN, API_TOKEN, options);
assertThat(api.getClient().interceptors(), hasItem(isA(HttpLoggingInterceptor.class)));
for (Interceptor i : api.getClient().interceptors()) {
if (i instanceof HttpLoggingInterceptor) {
HttpLoggingInterceptor logging = (HttpLoggingInterceptor) i;
assertThat(logging.getLevel(), is(Level.BASIC));
}
}
}
use of com.auth0.client.HttpOptions in project auth0-java by auth0.
the class ManagementAPITest method shouldUseCustomMaxRetriesIfConfigured.
@Test
public void shouldUseCustomMaxRetriesIfConfigured() {
HttpOptions options = new HttpOptions();
options.setManagementAPIMaxRetries(5);
ManagementAPI api = new ManagementAPI(DOMAIN, API_TOKEN, options);
assertThat(api.getClient().interceptors(), hasItem(isA(RateLimitInterceptor.class)));
for (Interceptor i : api.getClient().interceptors()) {
if (i instanceof RateLimitInterceptor) {
RateLimitInterceptor rateLimitInterceptor = (RateLimitInterceptor) i;
assertThat(rateLimitInterceptor.getMaxRetries(), is(5));
}
}
}
use of com.auth0.client.HttpOptions in project auth0-java by auth0.
the class AuthAPITest method shouldUseConfiguredMaxRequestsPerHost.
@Test
public void shouldUseConfiguredMaxRequestsPerHost() {
HttpOptions options = new HttpOptions();
options.setMaxRequestsPerHost(10);
AuthAPI api = new AuthAPI(DOMAIN, CLIENT_ID, CLIENT_SECRET, options);
assertThat(api.getClient().dispatcher().getMaxRequestsPerHost(), is(10));
}
Aggregations