@@ -171,29 +171,21 @@ private static Throwable nettyClientSpanErrorMapper(URI uri, Throwable exception
171171 if (uri .getPath ().equals ("/read-timeout" )) {
172172 return ReadTimeoutException .INSTANCE ;
173173 }
174+ // For non-routable address, Netty produces PrematureChannelClosureException on both platforms
174175 if (uri .toString ().equals ("https://192.0.2.1/" )) {
175- if (isWindows ()) {
176- Throwable rootCause = unwrapConnectionException (exception );
177- if (rootCause instanceof ClosedChannelException ) {
178- return new PrematureChannelClosureException ();
179- }
180- return exception ;
181- }
182- return new ConnectTimeoutException (
183- "connection timed out"
184- + (Boolean .getBoolean ("testLatestDeps" ) ? " after 2000 ms" : "" )
185- + ": /192.0.2.1:443" );
176+ return new PrematureChannelClosureException ();
186177 }
187- if (isWindows () && uri .toString ().equals ("http://localhost:61/" )) {
178+ // For unopened port, keep the platform-specific exception
179+ if (uri .toString ().equals ("http://localhost:61/" )) {
188180 return exception ;
189181 }
190182 return exception ;
191183 }
192184
193- // Netty still reports connection failures as CONNECT on Windows while Linux emits the HTTP
194- // method, so keep expectations OS-aware for the handful of endpoints that trigger this case .
185+ // Netty reports connection failures as CONNECT on both Windows and Linux for these
186+ // specific failure scenarios (unopened port and non-routable address) .
195187 private static String nettyExpectedClientSpanNameMapper (URI uri , String method ) {
196- if (OS . WINDOWS . isCurrentOs () && "GET" .equals (method )) {
188+ if ("GET" .equals (method )) {
197189 String target = uri .toString ();
198190 if ("http://localhost:61/" .equals (target ) || "https://192.0.2.1/" .equals (target )) {
199191 return "CONNECT" ;
0 commit comments