File tree Expand file tree Collapse file tree
java/src/org/openqa/selenium/remote/http/jdk Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,24 +135,7 @@ protected PasswordAuthentication getPasswordAuthentication() {
135135
136136 Proxy proxy = config .proxy ();
137137 if (proxy != null ) {
138- ProxySelector proxySelector =
139- new ProxySelector () {
140- @ Override
141- public List <Proxy > select (URI uri ) {
142- if (proxy == null ) {
143- return List .of ();
144- }
145- if (uri .getScheme ().toLowerCase ().startsWith ("http" )) {
146- return List .of (proxy );
147- }
148- return List .of ();
149- }
150-
151- @ Override
152- public void connectFailed (URI uri , SocketAddress sa , IOException ioe ) {
153- // Do nothing
154- }
155- };
138+ ProxySelector proxySelector = new HttpProxySelector (proxy );
156139 builder = builder .proxy (proxySelector );
157140 }
158141
@@ -488,4 +471,28 @@ public HttpClient createClient(ClientConfig config) {
488471 return new JdkHttpClient (config );
489472 }
490473 }
474+
475+ private static class HttpProxySelector extends ProxySelector {
476+ private final Proxy proxy ;
477+
478+ public HttpProxySelector (Proxy proxy ) {
479+ this .proxy = proxy ;
480+ }
481+
482+ @ Override
483+ public List <Proxy > select (URI uri ) {
484+ if (proxy == null ) {
485+ return List .of ();
486+ }
487+ if (uri .getScheme ().toLowerCase ().startsWith ("http" )) {
488+ return List .of (proxy );
489+ }
490+ return List .of ();
491+ }
492+
493+ @ Override
494+ public void connectFailed (URI uri , SocketAddress sa , IOException ioe ) {
495+ // Do nothing
496+ }
497+ }
491498}
You can’t perform that action at this time.
0 commit comments