소스 검색

[Test] Ignore closed connections on Windows hosts (#108362)

This commit adds special handling for the  `java.io.IOException: An established connection was aborted by the software in your host machine` in `Netty4HttpClient#exceptionCaught ` method. This exception only occurs when running tests on Windows hosts

Resolves: #108193
Slobodan Adamović 1 년 전
부모
커밋
93ec9d6142
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpClient.java

+ 6 - 1
modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpClient.java

@@ -40,6 +40,7 @@ import org.elasticsearch.test.ESTestCase;
 import org.elasticsearch.transport.netty4.NettyAllocator;
 
 import java.io.Closeable;
+import java.io.IOException;
 import java.net.SocketAddress;
 import java.net.SocketException;
 import java.nio.charset.StandardCharsets;
@@ -203,7 +204,11 @@ class Netty4HttpClient implements Closeable {
 
                 @Override
                 public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
-                    if (cause instanceof PrematureChannelClosureException || cause instanceof SocketException) {
+                    if (cause instanceof PrematureChannelClosureException
+                        || cause instanceof SocketException
+                        || (cause instanceof IOException
+                            && cause.getMessage() != null
+                            && cause.getMessage().contains("An established connection was aborted by the software in your host machine"))) {
                         // no more requests coming, so fast-forward the latch
                         fastForward();
                     } else {