File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66import java .io .Closeable ;
77import java .io .IOException ;
8+ import java .net .InetSocketAddress ;
89import java .net .Proxy ;
910import java .net .SocketTimeoutException ;
1011import java .util .UUID ;
@@ -282,8 +283,11 @@ private String getProxyAddress() {
282283 if (proxy == null || proxy .type () == Proxy .Type .DIRECT ) {
283284 return null ;
284285 }
285-
286- return proxy .toString ();
286+ if (proxy .address () instanceof InetSocketAddress ) {
287+ InetSocketAddress addr = (InetSocketAddress ) proxy .address ();
288+ return proxy .type () + " @ " + addr .getHostString () + ":" + addr .getPort ();
289+ }
290+ return proxy .type () + " @ " + proxy .address ();
287291 }
288292
289293 private Result <Config > deserializeConfig (String json , String cfRayId ) {
Original file line number Diff line number Diff line change @@ -512,7 +512,7 @@ public void getProxyUriWhenProxyIsHTTPReturnsFormattedHttpProxyUri() throws IOEx
512512
513513 String result = getProxyUriUsingReflection (fetcher );
514514
515- assertEquals ("HTTP @ proxy.example.com/<unresolved> :8080" , result );
515+ assertEquals ("HTTP @ proxy.example.com:8080" , result );
516516 fetcher .close ();
517517 }
518518
@@ -525,7 +525,7 @@ public void getProxyUriWhenProxyIsSOCKSReturnsFormattedSocks5ProxyUri() throws I
525525
526526 String result = getProxyUriUsingReflection (fetcher );
527527
528- assertEquals ("SOCKS @ socks.example.com/<unresolved> :1080" , result );
528+ assertEquals ("SOCKS @ socks.example.com:1080" , result );
529529 fetcher .close ();
530530 }
531531
You can’t perform that action at this time.
0 commit comments