diff --git a/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java b/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java index 465929a1933..ab169618ddf 100644 --- a/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java +++ b/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java @@ -43,13 +43,8 @@ public class SimpleNettyTransportTests extends AbstractSimpleTransportTests { return transportService; } - @Test + @Test(expected = ConnectTransportException.class) public void testConnectException() { - try { - serviceA.connectToNode(new DiscoveryNode("C", new InetSocketTransportAddress("localhost", 9876), Version.CURRENT)); - fail(); - } catch (ConnectTransportException e) { - // all is well - } + serviceA.connectToNode(new DiscoveryNode("C", new InetSocketTransportAddress("localhost", 9876), Version.CURRENT)); } } \ No newline at end of file