ServiceBindingBuilder extends AbstractServiceBindingBuilder { ServiceBindingBuilder(ServerBuilder serverBuilder) { this.serverBuilder = requireNonNull(serverBuilder, "serverBuilder"); } ServiceBindingBuilder(ServerBuilder serverBuilder); @Override ServiceBindingBuilder path(String pathPattern); @Override ServiceBindingBuilder pathPrefix(String prefix); @Override ServiceBindingBuilder methods(HttpMethod... methods); @Override ServiceBindingBuilder methods(Iterable<HttpMethod> methods); @Override ServiceBindingBuilder get(String pathPattern); @Override ServiceBindingBuilder post(String pathPattern); @Override ServiceBindingBuilder put(String pathPattern); @Override ServiceBindingBuilder patch(String pathPattern); @Override ServiceBindingBuilder delete(String pathPattern); @Override ServiceBindingBuilder options(String pathPattern); @Override ServiceBindingBuilder head(String pathPattern); @Override ServiceBindingBuilder trace(String pathPattern); @Override ServiceBindingBuilder connect(String pathPattern); @Override ServiceBindingBuilder consumes(MediaType... consumeTypes); @Override ServiceBindingBuilder consumes(Iterable<MediaType> consumeTypes); @Override ServiceBindingBuilder produces(MediaType... produceTypes); @Override ServiceBindingBuilder produces(Iterable<MediaType> produceTypes); @Override ServiceBindingBuilder matchesParams(String... paramPredicates); @Override ServiceBindingBuilder matchesParams(Iterable<String> paramPredicates); @Override ServiceBindingBuilder matchesParams(String paramName, Predicate<? super String> valuePredicate); @Override ServiceBindingBuilder matchesHeaders(String... headerPredicates); @Override ServiceBindingBuilder matchesHeaders(Iterable<String> headerPredicates); @Override ServiceBindingBuilder matchesHeaders(CharSequence headerName,
                                                Predicate<? super String> valuePredicate); @Override ServiceBindingBuilder addRoute(Route route); @Override ServiceBindingBuilder defaultServiceName(String defaultServiceName); @Override ServiceBindingBuilder defaultLogName(String defaultLogName); @Override ServiceBindingBuilder requestTimeout(Duration requestTimeout); @Override ServiceBindingBuilder requestTimeoutMillis(long requestTimeoutMillis); @Override ServiceBindingBuilder maxRequestLength(long maxRequestLength); @Override ServiceBindingBuilder verboseResponses(boolean verboseResponses); @Override ServiceBindingBuilder accessLogFormat(String accessLogFormat); @Override ServiceBindingBuilder accessLogWriter(AccessLogWriter accessLogWriter, boolean shutdownOnStop); @Override ServiceBindingBuilder decorator(Function<? super HttpService, ? extends HttpService> decorator); @Override @SafeVarargs final ServiceBindingBuilder decorators(
            Function<? super HttpService, ? extends HttpService>... decorators); @Override ServiceBindingBuilder decorators(
            Iterable<? extends Function<? super HttpService, ? extends HttpService>> decorators); ServerBuilder build(HttpService service);  }
@Test public void serviceBindingBuilder() { final ServerBuilder sb = Server.builder(); final AccessLogWriter accessLogWriter = mock(AccessLogWriter.class); sb.route().get("/foo/bar") .consumes(JSON, PLAIN_TEXT_UTF_8) .produces(JSON_UTF_8, PLAIN_TEXT_UTF_8) .requestTimeoutMillis(10) .maxRequestLength(8192) .verboseResponses(true) .accessLogWriter(accessLogWriter, true) .build((ctx, req) -> HttpResponse.of(OK)); final List<ServiceConfig> serviceConfigs = sb.build().serviceConfigs(); assertThat(serviceConfigs.size()).isOne(); final ServiceConfig serviceConfig = serviceConfigs.get(0); final Route route = serviceConfig.route(); assertThat(route.pathType()).isSameAs(RoutePathType.EXACT); assertThat(route.paths()).containsExactly("/foo/bar", "/foo/bar"); assertThat(route.consumes()).containsExactly(JSON, PLAIN_TEXT_UTF_8); assertThat(route.produces()).containsExactly(JSON_UTF_8, PLAIN_TEXT_UTF_8); assertThat(serviceConfig.requestTimeoutMillis()).isEqualTo(10); assertThat(serviceConfig.maxRequestLength()).isEqualTo(8192); assertThat(serviceConfig.verboseResponses()).isEqualTo(true); assertThat(serviceConfig.accessLogWriter()).isSameAs(accessLogWriter); assertThat(serviceConfig.shutdownAccessLogWriterOnStop()).isTrue(); }