diff --git a/test/framework/src/main/java/org/elasticsearch/transport/nio/NioTransport.java b/test/framework/src/main/java/org/elasticsearch/transport/nio/NioTransport.java index 27cb73f98f8..2902b0bccfd 100644 --- a/test/framework/src/main/java/org/elasticsearch/transport/nio/NioTransport.java +++ b/test/framework/src/main/java/org/elasticsearch/transport/nio/NioTransport.java @@ -184,9 +184,7 @@ public class NioTransport extends TcpTransport { return new SocketEventHandler(logger, this::exceptionCaught, openChannels); } - final void exceptionCaught(NioSocketChannel channel, Throwable cause) { - final Throwable unwrapped = ExceptionsHelper.unwrap(cause, ElasticsearchException.class); - final Throwable t = unwrapped != null ? unwrapped : cause; - onException(channel, t instanceof Exception ? (Exception) t : new ElasticsearchException(t)); + final void exceptionCaught(NioSocketChannel channel, Exception exception) { + onException(channel, exception); } } diff --git a/test/framework/src/main/java/org/elasticsearch/transport/nio/SocketEventHandler.java b/test/framework/src/main/java/org/elasticsearch/transport/nio/SocketEventHandler.java index b04ecc4ea9a..46292f63d1b 100644 --- a/test/framework/src/main/java/org/elasticsearch/transport/nio/SocketEventHandler.java +++ b/test/framework/src/main/java/org/elasticsearch/transport/nio/SocketEventHandler.java @@ -34,10 +34,10 @@ import java.util.function.BiConsumer; */ public class SocketEventHandler extends EventHandler { - private final BiConsumer exceptionHandler; + private final BiConsumer exceptionHandler; private final Logger logger; - public SocketEventHandler(Logger logger, BiConsumer exceptionHandler, OpenChannels openChannels) { + public SocketEventHandler(Logger logger, BiConsumer exceptionHandler, OpenChannels openChannels) { super(logger, openChannels); this.exceptionHandler = exceptionHandler; this.logger = logger; diff --git a/test/framework/src/main/java/org/elasticsearch/transport/nio/TcpReadHandler.java b/test/framework/src/main/java/org/elasticsearch/transport/nio/TcpReadHandler.java index b41d87a0c09..2cb59ed95d1 100644 --- a/test/framework/src/main/java/org/elasticsearch/transport/nio/TcpReadHandler.java +++ b/test/framework/src/main/java/org/elasticsearch/transport/nio/TcpReadHandler.java @@ -32,10 +32,9 @@ public class TcpReadHandler { this.transport = transport; } - public void handleMessage(BytesReference reference, NioSocketChannel channel, String profileName, - int messageBytesLength) { + public void handleMessage(BytesReference reference, NioSocketChannel channel, int messageBytesLength) { try { - transport.messageReceived(reference, channel, profileName, channel.getRemoteAddress(), messageBytesLength); + transport.messageReceived(reference, channel, channel.getProfile(), channel.getRemoteAddress(), messageBytesLength); } catch (IOException e) { handleException(channel, e); } diff --git a/test/framework/src/main/java/org/elasticsearch/transport/nio/channel/TcpReadContext.java b/test/framework/src/main/java/org/elasticsearch/transport/nio/channel/TcpReadContext.java index ee56f6f6f97..57aa16ce15e 100644 --- a/test/framework/src/main/java/org/elasticsearch/transport/nio/channel/TcpReadContext.java +++ b/test/framework/src/main/java/org/elasticsearch/transport/nio/channel/TcpReadContext.java @@ -80,7 +80,7 @@ public class TcpReadContext implements ReadContext { // A message length of 6 bytes it is just a ping. Ignore for now. if (messageLengthWithHeader != 6) { - handler.handleMessage(messageWithoutHeader, channel, channel.getProfile(), messageWithoutHeader.length()); + handler.handleMessage(messageWithoutHeader, channel, messageWithoutHeader.length()); } } catch (Exception e) { handler.handleException(channel, e); diff --git a/test/framework/src/test/java/org/elasticsearch/transport/nio/SocketEventHandlerTests.java b/test/framework/src/test/java/org/elasticsearch/transport/nio/SocketEventHandlerTests.java index b1c6fab2065..abbe023b97c 100644 --- a/test/framework/src/test/java/org/elasticsearch/transport/nio/SocketEventHandlerTests.java +++ b/test/framework/src/test/java/org/elasticsearch/transport/nio/SocketEventHandlerTests.java @@ -43,7 +43,7 @@ import static org.mockito.Mockito.when; public class SocketEventHandlerTests extends ESTestCase { - private BiConsumer exceptionHandler; + private BiConsumer exceptionHandler; private SocketEventHandler handler; private NioSocketChannel channel; diff --git a/test/framework/src/test/java/org/elasticsearch/transport/nio/TestingSocketEventHandler.java b/test/framework/src/test/java/org/elasticsearch/transport/nio/TestingSocketEventHandler.java index 7d3cf97ee08..65759cf7705 100644 --- a/test/framework/src/test/java/org/elasticsearch/transport/nio/TestingSocketEventHandler.java +++ b/test/framework/src/test/java/org/elasticsearch/transport/nio/TestingSocketEventHandler.java @@ -30,11 +30,8 @@ import java.util.function.BiConsumer; public class TestingSocketEventHandler extends SocketEventHandler { - private final Logger logger; - - public TestingSocketEventHandler(Logger logger, BiConsumer exceptionHandler, OpenChannels openChannels) { + public TestingSocketEventHandler(Logger logger, BiConsumer exceptionHandler, OpenChannels openChannels) { super(logger, exceptionHandler, openChannels); - this.logger = logger; } private Set hasConnectedMap = Collections.newSetFromMap(new WeakHashMap<>()); diff --git a/test/framework/src/test/java/org/elasticsearch/transport/nio/channel/TcpReadContextTests.java b/test/framework/src/test/java/org/elasticsearch/transport/nio/channel/TcpReadContextTests.java index fc8d7e48ab0..2b4db980102 100644 --- a/test/framework/src/test/java/org/elasticsearch/transport/nio/channel/TcpReadContextTests.java +++ b/test/framework/src/test/java/org/elasticsearch/transport/nio/channel/TcpReadContextTests.java @@ -72,7 +72,7 @@ public class TcpReadContextTests extends ESTestCase { readContext.read(); - verify(handler).handleMessage(new BytesArray(bytes), channel, PROFILE, messageLength); + verify(handler).handleMessage(new BytesArray(bytes), channel, messageLength); assertEquals(1024 * 16, bufferCapacity.get()); BytesArray bytesArray = new BytesArray(new byte[10]); @@ -110,7 +110,7 @@ public class TcpReadContextTests extends ESTestCase { assertEquals(1024 * 16 - fullPart1.length, bufferCapacity.get()); CompositeBytesReference reference = new CompositeBytesReference(new BytesArray(part1), new BytesArray(part2)); - verify(handler).handleMessage(reference, channel, PROFILE, messageLength + messageLength); + verify(handler).handleMessage(reference, channel, messageLength + messageLength); } public void testReadThrowsIOException() throws IOException {