The Google Ads API Java client library uses gRPC for transport and supports standard
Java system proxy settings for connecting to the API.

## Settings

The library supports the
[standard networking and proxy properties for Java](https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/net/doc-files/net-properties.html).

### Command-line configuration

For an HTTPS proxy, pass the following JVM arguments at application startup:

    -Dhttps.proxyHost=HOST -Dhttps.proxyPort=PORT

For an HTTP proxy (not recommended unless you're providing your own local HTTP
proxy endpoint), set the proxy configuration as:

    -Dhttp.proxyHost=HOST -Dhttp.proxyPort=PORT

### Programmatic configuration

You can also configure HTTP and HTTPS proxy properties programmatically at
runtime before creating your service clients:

    System.setProperty("https.proxyHost", "HOST");
    System.setProperty("https.proxyPort", "PORT");

> [!NOTE]
> **Note:** System properties modify global JVM state. Because gRPC channels cache transport settings at creation time, if you change these properties at runtime you must recreate any existing service clients (for example, by calling `googleAdsClient.getLatestVersion().createGoogleAdsServiceClient()`).

### Proxy authentication and bypass

If your proxy server requires authentication or host exclusions, specify the
additional JVM proxy properties:

    -Dhttps.proxyUser=USERNAME \
    -Dhttps.proxyPassword=PASSWORD \
    -Dhttp.nonProxyHosts="localhost|127.0.0.1"