From 9dab9eb76256d2a3b1fd83e180ec62c2991782fa Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Mon, 11 Jul 2016 12:16:53 +0200 Subject: [PATCH] Followup from elastic/elasticsearchelastic/elasticsearch#19332 Added missing IOException and simplified filtering out mock transports for security integration tests. Relates to elastic/elasticseachelastic/elasticsearch#19332 Original commit: elastic/x-pack-elasticsearch@8a5c015c3d6041100f46b00b795a77fdcdfd8650 --- .../transport/netty/SecurityNettyTransport.java | 3 ++- .../elasticsearch/test/SecurityIntegTestCase.java | 12 +++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/elasticsearch/x-pack/security/src/main/java/org/elasticsearch/xpack/security/transport/netty/SecurityNettyTransport.java b/elasticsearch/x-pack/security/src/main/java/org/elasticsearch/xpack/security/transport/netty/SecurityNettyTransport.java index 9a4adc8e320..b11bab1acf9 100644 --- a/elasticsearch/x-pack/security/src/main/java/org/elasticsearch/xpack/security/transport/netty/SecurityNettyTransport.java +++ b/elasticsearch/x-pack/security/src/main/java/org/elasticsearch/xpack/security/transport/netty/SecurityNettyTransport.java @@ -31,6 +31,7 @@ import org.jboss.netty.handler.ssl.SslHandler; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLParameters; +import java.io.IOException; import java.net.InetSocketAddress; import java.util.List; @@ -111,7 +112,7 @@ public class SecurityNettyTransport extends NettyTransport { } @Override - protected void onException(Channel channel, Exception e) { + protected void onException(Channel channel, Exception e) throws IOException { if (isNotSslRecordException(e)) { if (logger.isTraceEnabled()) { logger.trace("received plaintext traffic on a encrypted channel, closing connection {}", e, channel); diff --git a/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/test/SecurityIntegTestCase.java b/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/test/SecurityIntegTestCase.java index ca6720069c0..5548437e633 100644 --- a/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/test/SecurityIntegTestCase.java +++ b/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/test/SecurityIntegTestCase.java @@ -16,6 +16,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.plugins.Plugin; +import org.elasticsearch.transport.MockTcpTransportPlugin; import org.elasticsearch.xpack.security.InternalClient; import org.elasticsearch.xpack.security.Security; import org.elasticsearch.xpack.security.authc.support.SecuredString; @@ -177,11 +178,8 @@ public abstract class SecurityIntegTestCase extends ESIntegTestCase { } @Override - protected Collection> getMockPlugins() { - Set> plugins = new HashSet<>(super.getMockPlugins()); - plugins.remove(MockTransportService.TestPlugin.class); // security has its own transport service - plugins.remove(AssertingLocalTransport.TestPlugin.class); // security has its own transport - return plugins; + protected boolean addMockTransportService() { + return false; // security has its own transport service } @Override @@ -355,10 +353,6 @@ public abstract class SecurityIntegTestCase extends ESIntegTestCase { return internalCluster().getInstance(InternalClient.class); } - protected InternalClient internalClient(String node) { - return internalCluster().getInstance(InternalClient.class, node); - } - protected SecurityClient securityClient() { return securityClient(client()); }