Skip navigation links

Azure SDK for Java Reference Documentation

Azure Core OkHttp HTTP client library for Java

See: Description

Azure Core - HTTP - OkHttp 
Package Description
com.azure.core.http.okhttp
Package containing OkHttp HTTP client plugin for azure-core.

Azure Core OkHttp HTTP client library for Java

Azure Core OkHttp HTTP client is a plugin for the azure-core HTTP client API.

Getting started

Prerequisites

Adding the package to your product

<dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-core-http-okhttp</artifactId>
    <version>1.0.0</version>
</dependency>

Key concepts

Examples

The following sections provide several code snippets covering some of the most common client configuration scenarios.

Create a Simple Client

Create an OkHttp client using a connection timeout of 60 seconds and a read timeout of 120 seconds.

HttpClient client = new OkHttpAsyncHttpClientBuilder().build();

Create a Client with Proxy

Create an OkHttp client that is using a proxy.

HttpClient client = new OkHttpAsyncHttpClientBuilder()
    .proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("<proxy-host>", 8888)))
    .build();

Troubleshooting

Next steps

Contributing

If you would like to become an active contributor to this project please follow the instructions provided in Microsoft Azure Projects Contribution Guidelines.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Impressions

Skip navigation links
Visit the Azure for Java Developerssite for more Java documentation, including quick starts, tutorials, and code samples.

Copyright © 2019 Microsoft Corporation. All rights reserved.