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 27cb73f98f8c2..2902b0bccfd9d 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 @@ protected SocketEventHandler getSocketEventHandler() { 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 b04ecc4ea9a6f..46292f63d1bda 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 @@ */ 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 b41d87a0c0998..2cb59ed95d1c5 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 TcpReadHandler(NioTransport transport) { 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 ee56f6f6f9763..57aa16ce15e3b 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 int read() throws IOException { // 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 b1c6fab2065a9..abbe023b97c0b 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 @@ 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 7d3cf97ee08ee..65759cf770552 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 @@ 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 fc8d7e48ab0bf..2b4db98010238 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 void testSuccessfulRead() throws IOException { 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 void testPartialRead() throws IOException { 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 {