ClientOptions extends AbstractOptions<ClientOption<Object>, ClientOptionValue<Object>> { public static ClientOptions of() { return EMPTY; } private  ClientOptions(Iterable<? extends ClientOptionValue<?>> values); private  ClientOptions(ClientOptions baseOptions,
                          Iterable<? extends ClientOptionValue<?>> additionalValues); static ClientOptions of(); static ClientOptions of(ClientOptionValue<?>... values); static ClientOptions of(Iterable<? extends ClientOptionValue<?>> values); static ClientOptions of(ClientOptions baseOptions, ClientOptionValue<?>... additionalValues); static ClientOptions of(ClientOptions baseOptions,
                                   Iterable<? extends ClientOptionValue<?>> additionalValues); static ClientOptionsBuilder builder(); ClientFactory factory(); long writeTimeoutMillis(); long responseTimeoutMillis(); long maxResponseLength(); ClientDecoration decoration(); HttpHeaders headers(); Supplier<RequestId> requestIdGenerator(); Function<? super Endpoint, ? extends EndpointGroup> endpointRemapper(); ClientOptionsBuilder toBuilder(); static final ClientOption<ClientFactory> FACTORY; static final ClientOption<Long> WRITE_TIMEOUT_MILLIS; static final ClientOption<Long> RESPONSE_TIMEOUT_MILLIS; static final ClientOption<Long> MAX_RESPONSE_LENGTH; static final ClientOption<ClientDecoration> DECORATION; static final ClientOption<Supplier<RequestId>> REQUEST_ID_GENERATOR; static final ClientOption<Function<? super Endpoint, ? extends EndpointGroup>> ENDPOINT_REMAPPER; static final ClientOption<HttpHeaders> HEADERS; }
@Test void testAsMap() { final HttpHeaders httpHeader = HttpHeaders.of(HttpHeaderNames.of("x-user-defined"), "HEADER_VALUE"); final ClientOptions options = ClientOptions.of(HEADERS.newValue(httpHeader)); final Map<ClientOption<Object>, ClientOptionValue<Object>> map = options.asMap(); assertThat(map).hasSize(1); assertThat(map.get(HEADERS).value()).isEqualTo(httpHeader); }
@Test void testSetHeader() { final HttpHeaders httpHeader = HttpHeaders.of(HttpHeaderNames.of("x-user-defined"), "HEADER_VALUE"); final ClientOptions options = ClientOptions.of(HEADERS.newValue(httpHeader)); assertThat(options.get(HEADERS)).isEqualTo(httpHeader); final ClientOptions options2 = ClientOptions.of(); assertThat(options2.get(HEADERS)).isEqualTo(HttpHeaders.of()); }
@Test void testSetBlackListHeader() { assertThatThrownBy(() -> { ClientOptions.of(HEADERS.newValue( HttpHeaders.of(HttpHeaderNames.HOST, "localhost"))); }).isInstanceOf(IllegalArgumentException.class); }
@Test void testInvalidWriteTimeoutMillis() { assertThatThrownBy(() -> { ClientOptions.of(WRITE_TIMEOUT_MILLIS.newValue(null)); }).isInstanceOf(NullPointerException.class); }
@Test void testInvalidResponseTimeoutMillis() { assertThatThrownBy(() -> { ClientOptions.of(RESPONSE_TIMEOUT_MILLIS.newValue(null)); }).isInstanceOf(NullPointerException.class); }
@Test void testInvalidMaxResponseLength() { assertThatThrownBy(() -> { ClientOptions.of(MAX_RESPONSE_LENGTH.newValue(null)); }).isInstanceOf(NullPointerException.class); }