diff --git a/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java b/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java index a9e595e0c9134..b83f9e5f6883c 100644 --- a/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java @@ -2177,7 +2177,7 @@ public void handleException(TransportException exp) { assertThat(exp.getCause(), instanceOf(NodeNotConnectedException.class)); } else { // here the concurrent disconnect was faster and invoked the listener first - assertThat(exp.getClass(), instanceOf(NodeDisconnectedException.class)); + assertThat(exp, instanceOf(NodeDisconnectedException.class)); } } finally { latch.countDown();