import java.net.InetSocketAddress;
import java.net.Proxy;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.cloud.http.HttpTransportOptions;
import com.google.cloud.bigquery.BigQuery;
import com.google.cloud.bigquery.BigQueryOptions;

var proxy = new Proxy(Proxy.Type.HTTP,
    new InetSocketAddress("proxy.example", 8080));
var httpOptions = HttpTransportOptions.newBuilder()
    .setHttpTransportFactory(() ->
        new NetHttpTransport.Builder().setProxy(proxy).build())
    .build();

BigQuery bigQuery = BigQueryOptions.newBuilder()
    .setProjectId(projectId)
    .setCredentials(credentials)
    .setTransportOptions(httpOptions)
    .build()
    .getService();

Use this bigQuery instance for the REST operations. projectId and credentials come from the application's existing configuration.

The factory creates the HTTP transport that reaches the BigQuery API through the intermediary. The API endpoint stays the destination; replacing it with the proxy address asks for a different service. For a permitted public-proxy route to BigQuery, the HTTP proxy list supplies candidates for the InetSocketAddress fields.

Credential acquisition or refresh can have its own HTTP transport, so configure that supported input when its requests need the proxy. These REST options also do not configure an independent gRPC channel.

For system discovery, java.net.useSystemProxies has platform-specific behavior and does not guarantee a Docker HTTP_PROXY value becomes this client's route. The explicit factory above makes the selected REST transport visible at construction.

ХӀокхунах тера йаззамаш