diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 324d98d6be..f68e412e12 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -9,7 +9,7 @@ on: jobs: build: - runs-on: ubuntu-16.04 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - name: Set up JDK 1.8 diff --git a/client/src/test/java/org/asynchttpclient/AsyncStreamHandlerTest.java b/client/src/test/java/org/asynchttpclient/AsyncStreamHandlerTest.java index 1547872aaa..ce7607e92e 100644 --- a/client/src/test/java/org/asynchttpclient/AsyncStreamHandlerTest.java +++ b/client/src/test/java/org/asynchttpclient/AsyncStreamHandlerTest.java @@ -436,7 +436,10 @@ public void asyncOptionsTest() throws Throwable { final AtomicReference responseHeaders = new AtomicReference<>(); + // Some responses contain the TRACE method, some do not - account for both + // FIXME: Actually refactor this test to account for both cases final String[] expected = {"GET", "HEAD", "OPTIONS", "POST"}; + final String[] expectedWithTrace = {"GET", "HEAD", "OPTIONS", "POST", "TRACE"}; Future f = client.prepareOptions("http://www.apache.org/").execute(new AsyncHandlerAdapter() { @Override @@ -455,10 +458,16 @@ public String onCompleted() { HttpHeaders h = responseHeaders.get(); assertNotNull(h); String[] values = h.get(ALLOW).split(",|, "); - assertNotNull(values); - assertEquals(values.length, expected.length); + assertNotNull(values); + // Some responses contain the TRACE method, some do not - account for both + assert(values.length == expected.length || values.length == expectedWithTrace.length); Arrays.sort(values); - assertEquals(values, expected); + // Some responses contain the TRACE method, some do not - account for both + if(values.length == expected.length) { + assertEquals(values, expected); + } else { + assertEquals(values, expectedWithTrace); + } })); } diff --git a/client/src/test/java/org/asynchttpclient/channel/MaxTotalConnectionTest.java b/client/src/test/java/org/asynchttpclient/channel/MaxTotalConnectionTest.java index fcf34896f6..492399e3af 100644 --- a/client/src/test/java/org/asynchttpclient/channel/MaxTotalConnectionTest.java +++ b/client/src/test/java/org/asynchttpclient/channel/MaxTotalConnectionTest.java @@ -69,7 +69,7 @@ public void testMaxTotalConnectionsExceedingException() throws IOException { @Test(groups = "online") public void testMaxTotalConnections() throws Exception { - String[] urls = new String[]{"https://google.com", "https://github.com"}; + String[] urls = new String[]{"https://www.google.com", "https://www.youtube.com"}; final CountDownLatch latch = new CountDownLatch(2); final AtomicReference ex = new AtomicReference<>(); diff --git a/client/src/test/java/org/asynchttpclient/ws/TextMessageTest.java b/client/src/test/java/org/asynchttpclient/ws/TextMessageTest.java index d3249944d4..72c3e1d244 100644 --- a/client/src/test/java/org/asynchttpclient/ws/TextMessageTest.java +++ b/client/src/test/java/org/asynchttpclient/ws/TextMessageTest.java @@ -16,6 +16,7 @@ import org.testng.annotations.Test; import java.net.UnknownHostException; +import java.net.ConnectException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicReference; @@ -70,11 +71,14 @@ public void onEmptyListenerTest() throws Exception { } } - @Test(timeOut = 60000, expectedExceptions = UnknownHostException.class) + @Test(timeOut = 60000, expectedExceptions = {UnknownHostException.class, ConnectException.class}) public void onFailureTest() throws Throwable { try (AsyncHttpClient c = asyncHttpClient()) { c.prepareGet("ws://abcdefg").execute(new WebSocketUpgradeHandler.Builder().build()).get(); } catch (ExecutionException e) { + + String expectedMessage = "DNS name not found"; + assertTrue(e.getCause().toString().contains(expectedMessage)); throw e.getCause(); } }