sdk/communication/azure-communication-chat/src/main/java/com/azure/android/communication/chat/ChatClientBuilder.java [195:234]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        HttpPipeline pipeline;
        if (this.httpPipeline != null) {
            pipeline = this.httpPipeline;
        } else {
            if (this.communicationTokenCredential == null) {
                throw logger
                    .logExceptionAsError(
                        new NullPointerException(
                            "CommunicationTokenCredential is required."));
            }

            HttpPipelinePolicy authorizationPolicy = chain -> {
                final CompletableFuture<CommunicationAccessToken> tokenFuture
                    = this.communicationTokenCredential.getToken();
                final CommunicationAccessToken token;
                try {
                    token = tokenFuture.get();
                } catch (ExecutionException e) {
                    chain.completedError(e);
                    return;
                } catch (InterruptedException e) {
                    chain.completedError(e);
                    return;
                }
                HttpRequest httpRequest = chain.getRequest();
                httpRequest.getHeaders().put("Authorization", "Bearer " + token.getToken());
                chain.processNextPolicy(httpRequest);
            };

            pipeline = createHttpPipeline(this.httpClient,
                authorizationPolicy,
                this.customPolicies);
        }

        AzureCommunicationChatServiceImplBuilder clientBuilder = new AzureCommunicationChatServiceImplBuilder()
            .apiVersion((this.serviceVersion == null)
                ? ChatServiceVersion.getLatest().getVersion()
                : this.serviceVersion.getVersion())
            .endpoint(this.endpoint)
            .pipeline(pipeline);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



sdk/communication/azure-communication-chat/src/main/java/com/azure/android/communication/chat/ChatThreadClientBuilder.java [215:255]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        HttpPipeline pipeline;

        if (this.httpPipeline != null) {
            pipeline = this.httpPipeline;
        } else {
            if (this.communicationTokenCredential == null) {
                throw logger
                    .logExceptionAsError(
                        new NullPointerException(
                            "CommunicationTokenCredential is required."));
            }

            HttpPipelinePolicy authorizationPolicy = chain -> {
                final CompletableFuture<CommunicationAccessToken> tokenFuture
                    = this.communicationTokenCredential.getToken();
                final CommunicationAccessToken token;
                try {
                    token = tokenFuture.get();
                } catch (ExecutionException e) {
                    chain.completedError(e);
                    return;
                } catch (InterruptedException e) {
                    chain.completedError(e);
                    return;
                }
                HttpRequest httpRequest = chain.getRequest();
                httpRequest.getHeaders().put("Authorization", "Bearer " + token.getToken());
                chain.processNextPolicy(httpRequest);
            };

            pipeline = createHttpPipeline(this.httpClient,
                authorizationPolicy,
                this.customPolicies);
        }

        AzureCommunicationChatServiceImplBuilder clientBuilder = new AzureCommunicationChatServiceImplBuilder()
            .apiVersion((this.serviceVersion == null)
                ? ChatServiceVersion.getLatest().getVersion()
                : this.serviceVersion.getVersion())
            .endpoint(this.endpoint)
            .pipeline(pipeline);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



