@@ -147,18 +147,9 @@ public ProxySelector get() {
147
147
}
148
148
};
149
149
150
- /**
151
- * Experimental environment variable name for enabling proxy support.
152
- *
153
- * @deprecated Use the standard Java proxy configuration instead with flags such as:
154
- * -Dhttps.proxyHost=HOST -Dhttps.proxyPort=PORT
155
- */
156
- @ Deprecated
157
- private static final String GRPC_PROXY_ENV_VAR = "GRPC_PROXY_EXP" ;
158
150
// Do not hard code a ProxySelector because the global default ProxySelector can change
159
151
private final Supplier <ProxySelector > proxySelector ;
160
152
private final AuthenticationProvider authenticationProvider ;
161
- private final InetSocketAddress overrideProxyAddress ;
162
153
163
154
// We want an HTTPS proxy, which operates on the entire data stream (See IETF rfc2817).
164
155
static final String PROXY_SCHEME = "https" ;
@@ -168,21 +159,15 @@ public ProxySelector get() {
168
159
* {@link ProxyDetectorImpl.AuthenticationProvider} to detect proxy parameters.
169
160
*/
170
161
public ProxyDetectorImpl () {
171
- this (DEFAULT_PROXY_SELECTOR , DEFAULT_AUTHENTICATOR , System . getenv ( GRPC_PROXY_ENV_VAR ) );
162
+ this (DEFAULT_PROXY_SELECTOR , DEFAULT_AUTHENTICATOR );
172
163
}
173
164
174
165
@ VisibleForTesting
175
166
ProxyDetectorImpl (
176
167
Supplier <ProxySelector > proxySelector ,
177
- AuthenticationProvider authenticationProvider ,
178
- @ Nullable String proxyEnvString ) {
168
+ AuthenticationProvider authenticationProvider ) {
179
169
this .proxySelector = checkNotNull (proxySelector );
180
170
this .authenticationProvider = checkNotNull (authenticationProvider );
181
- if (proxyEnvString != null ) {
182
- overrideProxyAddress = overrideProxy (proxyEnvString );
183
- } else {
184
- overrideProxyAddress = null ;
185
- }
186
171
}
187
172
188
173
@ Nullable
@@ -191,12 +176,6 @@ public ProxiedSocketAddress proxyFor(SocketAddress targetServerAddress) throws I
191
176
if (!(targetServerAddress instanceof InetSocketAddress )) {
192
177
return null ;
193
178
}
194
- if (overrideProxyAddress != null ) {
195
- return HttpConnectProxiedSocketAddress .newBuilder ()
196
- .setProxyAddress (overrideProxyAddress )
197
- .setTargetAddress ((InetSocketAddress ) targetServerAddress )
198
- .build ();
199
- }
200
179
return detectProxy ((InetSocketAddress ) targetServerAddress );
201
180
}
202
181
@@ -272,27 +251,6 @@ private ProxiedSocketAddress detectProxy(InetSocketAddress targetAddr) throws IO
272
251
.build ();
273
252
}
274
253
275
- /**
276
- * GRPC_PROXY_EXP is deprecated but let's maintain compatibility for now.
277
- */
278
- private static InetSocketAddress overrideProxy (String proxyHostPort ) {
279
- if (proxyHostPort == null ) {
280
- return null ;
281
- }
282
-
283
- String [] parts = proxyHostPort .split (":" , 2 );
284
- int port = 80 ;
285
- if (parts .length > 1 ) {
286
- port = Integer .parseInt (parts [1 ]);
287
- }
288
- log .warning (
289
- "Detected GRPC_PROXY_EXP and will honor it, but this feature will "
290
- + "be removed in a future release. Use the JVM flags "
291
- + "\" -Dhttps.proxyHost=HOST -Dhttps.proxyPort=PORT\" to set the https proxy for "
292
- + "this JVM." );
293
- return new InetSocketAddress (parts [0 ], port );
294
- }
295
-
296
254
/**
297
255
* This interface makes unit testing easier by avoiding direct calls to static methods.
298
256
*/
0 commit comments