Skip to content

Commit 15f93aa

Browse files
committed
chore(readme): update readme to contain info for setting up a proxy with the authenticator
1 parent eef20a4 commit 15f93aa

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
@@ -260,20 +260,24 @@ System.out.println("Response header names: " + responseHeaders.names());
260260

261261
### Configuring the HTTP client
262262

263-
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:
263+
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:
264264
- Disabling SSL verification (only do this if you really mean to!) ⚠️
265265
- Using a proxy (more info here: [OkHTTPClient Proxy authentication how to?](https://stackoverflow.com/a/35567936/456564))
266266
- Setting HTTP logging verbosity
267267

268268
Here's an example of setting the above:
269269

270270
```java
271-
Discovery service = new Discovery("2019-04-30");
271+
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", 8080));
272+
IamAuthenticator authenticator = new IamAuthenticator(apiKey);
273+
authenticator.setProxy(proxy);
274+
275+
Discovery service = new Discovery("2019-04-30", authenticator);
272276

273277
// setting configuration options
274278
HttpConfigOptions options = new HttpConfigOptions.Builder()
275279
.disableSslVerification(true)
276-
.proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", 8080)))
280+
.proxy(proxy)
277281
.loggingLevel(HttpConfigOptions.LoggingLevel.BASIC)
278282
.build();
279283

0 commit comments

Comments
 (0)