I
InsightNexus

OkHttpAsyncHttpClientBuilder (Azure SDK for Java Reference Documentation)

Author

Michael Gray

Published Feb 16, 2026

OkHttpAsyncHttpClientBuilder (Azure SDK for Java Reference Documentation)
  • Prev Class
  • Next Class
    • Constructor Detail

    • Method Detail

      • addNetworkInterceptor

        public OkHttpAsyncHttpClientBuilder addNetworkInterceptor(okhttp3.Interceptor networkInterceptor)

        Add a network layer interceptor to Http request pipeline.

        Parameters:
        networkInterceptor - the interceptor to add
        Returns:
        the updated OkHttpAsyncHttpClientBuilder object
      • networkInterceptors

        public OkHttpAsyncHttpClientBuilder networkInterceptors(List<okhttp3.Interceptor> networkInterceptors)

        Add network layer interceptors to Http request pipeline. This replaces all previously-set interceptors.

        Parameters:
        networkInterceptors - the interceptors to add
        Returns:
        the updated OkHttpAsyncHttpClientBuilder object
      • readTimeout

        public OkHttpAsyncHttpClientBuilder readTimeout(Duration readTimeout)

        Sets the read timeout. The default read timeout is 120 seconds.

        Parameters:
        readTimeout - the read timeout
        Returns:
        the updated OkHttpAsyncHttpClientBuilder object
      • connectionTimeout

        public OkHttpAsyncHttpClientBuilder connectionTimeout(Duration connectionTimeout)

        Sets the connection timeout. The default connection timeout is 60 seconds.

        Parameters:
        connectionTimeout - the connection timeout
        Returns:
        the updated OkHttpAsyncHttpClientBuilder object
      • connectionPool

        public OkHttpAsyncHttpClientBuilder connectionPool(okhttp3.ConnectionPool connectionPool)

        Sets the Http connection pool.

        Parameters:
        connectionPool - the OkHttp connection pool to use
        Returns:
        the updated OkHttpAsyncHttpClientBuilder object
      • dispatcher

        public OkHttpAsyncHttpClientBuilder dispatcher(okhttp3.Dispatcher dispatcher)

        Sets the dispatcher that also composes the thread pool for executing HTTP requests.

        Parameters:
        dispatcher - the dispatcher to use
        Returns:
        the updated OkHttpAsyncHttpClientBuilder object
      • build

        public HttpClient build()

        Build a HttpClient with current configurations.

        Returns:
        a HttpClient.
  • Prev Class
  • Next Class

Copyright © 2020 Microsoft Corporation. All rights reserved.