Skip to content

Commit 7d707a1

Browse files
author
Christoph Läubrich
committed
Check for java version
1 parent 06dea51 commit 7d707a1

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/test/java/io/github/laeubi/httpclient/JavaHttpClientConnectionReuseTest.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
import static org.junit.jupiter.api.Assertions.assertNotNull;
55
import static org.junit.jupiter.api.Assertions.assertTrue;
66

7+
import java.lang.Runtime.Version;
78
import java.net.http.HttpClient;
89
import java.net.http.HttpRequest;
910
import java.net.http.HttpResponse;
1011
import java.util.ArrayList;
1112
import java.util.List;
1213
import java.util.concurrent.CompletableFuture;
13-
import java.util.concurrent.ExecutionException;
1414

1515
import org.junit.jupiter.api.AfterAll;
1616
import org.junit.jupiter.api.BeforeAll;
@@ -26,6 +26,22 @@ public class JavaHttpClientConnectionReuseTest extends JavaHttpClientBase {
2626
@BeforeAll
2727
public static void startServers() throws Exception {
2828
startHttpsServerNoGoaway();
29+
assertTrue(isGoodJavaVersion(), Runtime.version() + " is known to contain the bug");
30+
}
31+
32+
private static boolean isGoodJavaVersion() {
33+
Version version = Runtime.version();
34+
int feature = version.feature();
35+
if (feature >= 25) {
36+
return true;
37+
}
38+
if (feature == 17 && version.compareTo(Version.parse("17.0.17")) >= 0) {
39+
return true;
40+
}
41+
if (feature == 21 && version.compareTo(Version.parse("21.0.8")) >= 0) {
42+
return true;
43+
}
44+
return false;
2945
}
3046

3147
@AfterAll

0 commit comments

Comments
 (0)