From a33bcc6f1eb01e63a43d3cbca57596916752fd64 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Fri, 14 May 2021 12:48:05 +0200 Subject: [PATCH] Cast in test to be able to run on ealier versions of java (#282) Motivation: SSLEngine.getApplicationProtocol may not exists on earlier versions of java. Modifications: Cast to QuicheQuicSslEngine to allow running on older version of java Result: Works on older Java8 releases as well --- .../netty/incubator/codec/quic/QuicChannelConnectTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/java/io/netty/incubator/codec/quic/QuicChannelConnectTest.java b/src/test/java/io/netty/incubator/codec/quic/QuicChannelConnectTest.java index 22a20939e..2e4532ce4 100644 --- a/src/test/java/io/netty/incubator/codec/quic/QuicChannelConnectTest.java +++ b/src/test/java/io/netty/incubator/codec/quic/QuicChannelConnectTest.java @@ -285,7 +285,10 @@ public int maxTokenLength() { stream.writeAndFlush(Unpooled.directBuffer().writeZero(numBytes)).sync(); clientLatch.await(); - assertEquals(QuicTestUtils.PROTOS[0], quicChannel.sslEngine().getApplicationProtocol()); + assertEquals(QuicTestUtils.PROTOS[0], + // Just do the cast as getApplicationProtocol() only exists in SSLEngine itself since Java9+ and + // we may run on an earlier version + ((QuicheQuicSslEngine) quicChannel.sslEngine()).getApplicationProtocol()); stream.close().sync(); quicChannel.close().sync(); ChannelFuture closeFuture = quicChannel.closeFuture().await();