This is an automated email from the ASF dual-hosted git repository. ggrzybek pushed a commit to branch karaf-4.2.x in repository https://gitbox.apache.org/repos/asf/karaf.git
The following commit(s) were added to refs/heads/karaf-4.2.x by this push: new d5bad11 [KARAF-6517] Implement no-arg createSocket() for SSLSocketFactory extension d5bad11 is described below commit d5bad11073495a1a3bcfe26332d31bde55368bca Author: Grzegorz Grzybek <gr.grzy...@gmail.com> AuthorDate: Wed Nov 13 15:58:28 2019 +0100 [KARAF-6517] Implement no-arg createSocket() for SSLSocketFactory extension (cherry picked from commit 1819b9315b363a1174ea369f10b90b1480f86ecb) --- .../karaf/jaas/modules/ldap/ManagedSSLSocketFactory.java | 5 +++++ .../org/apache/karaf/jaas/modules/ldap/LdapPoolingTest.java | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/ManagedSSLSocketFactory.java b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/ManagedSSLSocketFactory.java index f1c3af2..9e158bd 100644 --- a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/ManagedSSLSocketFactory.java +++ b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/ManagedSSLSocketFactory.java @@ -53,6 +53,11 @@ public class ManagedSSLSocketFactory extends SSLSocketFactory implements Compara return delegate.getSupportedCipherSuites(); } + @Override + public Socket createSocket() throws IOException { + return delegate.createSocket(); + } + public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException { return delegate.createSocket(s, host, port, autoClose); } diff --git a/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LdapPoolingTest.java b/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LdapPoolingTest.java index 4f2a48d..1f85506 100644 --- a/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LdapPoolingTest.java +++ b/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LdapPoolingTest.java @@ -81,6 +81,7 @@ public class LdapPoolingTest extends AbstractLdapTestUnit { System.setProperty("com.sun.jndi.ldap.connect.pool.debug", "all"); Hashtable<String, String> env = new Hashtable<>(); env.put("com.sun.jndi.ldap.connect.pool", "true"); + env.put("com.sun.jndi.ldap.connect.timeout", "5000"); env.put("java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory"); env.put("java.naming.provider.url", "ldaps://localhost:" + getLdapServer().getPortSSL() + "/ou=system"); env.put("java.naming.ldap.factory.socket", ManagedSSLSocketFactory.class.getName()); @@ -92,6 +93,11 @@ public class LdapPoolingTest extends AbstractLdapTestUnit { final int[] socketsCreated = new int[] { 0 }; ManagedSSLSocketFactory.setSocketFactory(new ManagedSSLSocketFactory(sslContext.getSocketFactory()) { @Override + public Socket createSocket() throws IOException { + socketsCreated[0]++; + return super.createSocket(); + } + @Override public Socket createSocket(String host, int port) throws IOException { socketsCreated[0]++; return super.createSocket(host, port); @@ -124,6 +130,11 @@ public class LdapPoolingTest extends AbstractLdapTestUnit { final int[] socketsCreated = new int[] { 0 }; ManagedSSLSocketFactory.setSocketFactory(new ManagedSSLSocketFactory(sslContext.getSocketFactory()) { @Override + public Socket createSocket() throws IOException { + socketsCreated[0]++; + return super.createSocket(); + } + @Override public Socket createSocket(String host, int port) throws IOException { socketsCreated[0]++; return super.createSocket(host, port);