Source:
<T> T clientSetup(Function<HttpPipeline, T> clientBuilder) { final String endpoint = interceptorManager.isPlaybackMode() ? "http://localhost:8080" : System.getenv("AZURE_KEYVAULT_ENDPOINT"); TokenCredential credential; if (interceptorManager.isPlaybackMode()) { credential = resource -> Mono.just(new AccessToken("Some fake token", OffsetDateTime.now(ZoneOffset.UTC).plus(Duration.ofMinutes(30)))); } else { credential = new DefaultAzureCredentialBuilder().build(); } HttpClient httpClient; final List<HttpPipelinePolicy> policies = new ArrayList<>(); policies.add(new UserAgentPolicy(null, AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, Configuration.getGlobalConfiguration().clone(), KeyServiceVersion.getLatest())); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(new RetryPolicy()); policies.add(new BearerTokenAuthenticationPolicy(credential, KeyAsyncClient.KEY_VAULT_SCOPE)); policies.addAll(policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))); if (interceptorManager.isPlaybackMode()) { httpClient = interceptorManager.getPlaybackClient(); policies.add(interceptorManager.getRecordPolicy()); } else { httpClient = new NettyAsyncHttpClientBuilder().wiretap(true).build(); policies.add(interceptorManager.getRecordPolicy()); } HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); T client; client = clientBuilder.apply(pipeline); return Objects.requireNonNull(client); }

Target:
<T> T clientSetup(Function<HttpPipeline, T> clientBuilder) { final String endpoint = interceptorManager.isPlaybackMode() ? "http://localhost:8080" : System.getenv("AZURE_KEYVAULT_ENDPOINT"); TokenCredential credential; if (interceptorManager.isPlaybackMode()) { credential = resource -> Mono.just(new AccessToken("Some fake token", OffsetDateTime.now(ZoneOffset.UTC).plus(Duration.ofMinutes(30)))); } else { credential = new DefaultAzureCredentialBuilder().build(); } HttpClient httpClient; final List<HttpPipelinePolicy> policies = new ArrayList<>(); policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, Configuration.getGlobalConfiguration().clone(), KeyServiceVersion.getLatest())); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(new RetryPolicy()); policies.add(new BearerTokenAuthenticationPolicy(credential, KeyAsyncClient.KEY_VAULT_SCOPE)); policies.addAll(policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))); if (interceptorManager.isPlaybackMode()) { httpClient = interceptorManager.getPlaybackClient(); policies.add(interceptorManager.getRecordPolicy()); } else { httpClient = new NettyAsyncHttpClientBuilder().wiretap(true).build(); policies.add(interceptorManager.getRecordPolicy()); } HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); T client; client = clientBuilder.apply(pipeline); return Objects.requireNonNull(client); }