### Question:
ClientImpl implements Client { @Override public WebTarget target(UriBuilder builder) { checkNull(builder); checkClosed(); return new WebTargetImpl(builder, getConfiguration()); } ClientImpl(Configuration config,
                      TLSConfiguration secConfig); @Override void close(); @Override Builder invocation(Link link); @Override WebTarget target(UriBuilder builder); @Override WebTarget target(String address); @Override WebTarget target(Link link); @Override WebTarget target(URI uri); @Override HostnameVerifier getHostnameVerifier(); @Override SSLContext getSslContext(); @Override Configuration getConfiguration(); @Override Client property(String name, Object value); @Override Client register(Class<?> cls); @Override Client register(Object object); @Override Client register(Class<?> cls, int index); @Override Client register(Class<?> cls, Class<?>... contracts); @Override Client register(Class<?> cls, Map<Class<?>, Integer> map); @Override Client register(Object object, int index); @Override Client register(Object object, Class<?>... contracts); @Override Client register(Object object, Map<Class<?>, Integer> map);  }### Answer:
@Test public void testClientConfigCopiedOnPathCallWithTemplates() { Client client = ClientBuilder.newClient(); WebTarget webTarget = client.target("http: WebClient webClient = getWebClient(webTarget); ClientConfiguration clientConfig = WebClient.getConfig(webClient); clientConfig.setOutInterceptors(Arrays.asList(new MyInterceptor())); assertTrue("Precondition failed - original WebTarget is missing expected interceptor", doesClientConfigHaveMyInterceptor(webClient)); WebTarget webTargetAfterPath = webTarget.path("/rest/{key}/").resolveTemplate("key", "myKey"); WebClient webClientAfterPath = getWebClient(webTargetAfterPath); assertTrue("New WebTarget is missing expected interceptor specified on 'parent' WebTarget's client impl", doesClientConfigHaveMyInterceptor(webClientAfterPath)); }
@Test public void testTemplateInInitialTarget() { String address = "http: Client client = ClientBuilder.newClient(); WebTarget webTarget = client.target(address).resolveTemplate("a", "bookheaders"); webTarget.request("application/xml").header("a", "b"); WebClient webClient = getWebClient(webTarget); ClientConfiguration clientConfig = WebClient.getConfig(webClient); clientConfig.setOutInterceptors(Arrays.asList(new MyInterceptor())); assertTrue("Precondition failed - original WebTarget is missing expected interceptor", doesClientConfigHaveMyInterceptor(webClient)); WebTarget webTargetAfterPath = webTarget.path("/rest/{key}/").resolveTemplate("key", "myKey"); WebClient webClientAfterPath = getWebClient(webTargetAfterPath); assertTrue("New WebTarget is missing expected interceptor specified on 'parent' WebTarget's client impl", doesClientConfigHaveMyInterceptor(webClientAfterPath)); }
@Test public void testAccessInvocationBuilderConcurrently() { String address = "http: Client client = ClientBuilder.newClient(); final Invocation.Builder builder = client .target(address) .resolveTemplate("a", "bookheaders") .request("application/xml") .header("a", "b"); final ExecutorService executor = Executors.newFixedThreadPool(20); final CyclicBarrier barrier = new CyclicBarrier(20); final Collection<CompletableFuture<?>> futures = new ArrayList<>(); for (int i = 0; i < 20; ++i) { futures.add(CompletableFuture.supplyAsync(() -> { try { barrier.await(1, TimeUnit.SECONDS); return builder.buildGet(); } catch (final InterruptedException ex) { Thread.interrupted(); throw new CompletionException(ex); } catch (BrokenBarrierException | TimeoutException ex) { throw new CompletionException(ex); } }, executor)); } CompletableFuture .allOf(futures.toArray(new CompletableFuture<?>[0])) .join(); }