Skip to content

Commit 55ed3db

Browse files
committed
chore(readme): update readme to contain info for setting up a proxy with the authenticator
1 parent bd6ae8b commit 55ed3db

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,20 +275,24 @@ System.out.println("Response header names: " + responseHeaders.names());
275275

276276
### Configuring the HTTP client
277277

278-
The HTTP client can be configured by using the `configureClient()` method on your service object, passing in an `HttpConfigOptions` object. Currently, the following options are supported:
278+
The HTTP client can be configured by using the `setProxy()` method on your authenticator and using the `configureClient()` method on your service object, passing in an `HttpConfigOptions` object. Currently, the following options are supported:
279279
- Disabling SSL verification (only do this if you really mean to!) ⚠️
280280
- Using a proxy (more info here: [OkHTTPClient Proxy authentication how to?](https://stackoverflow.com/a/35567936/456564))
281281
- Setting HTTP logging verbosity
282282

283283
Here's an example of setting the above:
284284

285285
```java
286-
Discovery service = new Discovery("2019-04-30");
286+
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", 8080));
287+
IamAuthenticator authenticator = new IamAuthenticator(apiKey);
288+
authenticator.setProxy(proxy);
289+
290+
Discovery service = new Discovery("2019-04-30", authenticator);
287291

288292
// setting configuration options
289293
HttpConfigOptions options = new HttpConfigOptions.Builder()
290294
.disableSslVerification(true)
291-
.proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", 8080)))
295+
.proxy(proxy)
292296
.loggingLevel(HttpConfigOptions.LoggingLevel.BASIC)
293297
.build();
294298

0 commit comments

Comments
 (0)