[ 
https://issues.apache.org/jira/browse/DIRMINA-1199?focusedWorklogId=1046535&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1046535
 ]

ASF GitHub Bot logged work on DIRMINA-1199:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 09/Oct/26 06:48
            Start Date: 09/Oct/26 06:48
    Worklog Time Spent: 10m 
      Work Description: tomaswolf commented on code in PR #77:
URL: https://github.com/apache/mina/pull/77#discussion_r4227384313


##########
mina-core/src/test/java/org/apache/mina/filter/ssl/SslEnd2EndTest.java:
##########
@@ -0,0 +1,364 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.filter.ssl;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
+import org.apache.mina.core.future.ConnectFuture;
+import org.apache.mina.core.future.WriteFuture;
+import org.apache.mina.core.service.IoAcceptor;
+import org.apache.mina.core.service.IoConnector;
+import org.apache.mina.core.service.IoHandler;
+import org.apache.mina.core.service.IoHandlerAdapter;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
+import org.apache.mina.transport.socket.nio.NioSocketConnector;
+import org.apache.mina.util.AcceptorBindUtil;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManagerFactory;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+import java.security.Security;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+@RunWith(Parameterized.class)
+public class SslEnd2EndTest {
+
+    private static final String KEY_MANAGER_FACTORY_ALGORITHM;
+    private static final int MAX_LENGTH = 1024 * 1024 * 8;
+
+    static {
+        String algorithm = 
Security.getProperty("ssl.KeyManagerFactory.algorithm");
+        if (algorithm == null) {
+            algorithm = KeyManagerFactory.getDefaultAlgorithm();
+        }
+
+        KEY_MANAGER_FACTORY_ALGORITHM = algorithm;
+    }
+
+    @Parameterized.Parameters(name = "{index}: {0} / {1} / {2} / {3}")
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][]{
+                {"TLSv1.2", "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256", 
2048, 0},
+                {"TLSv1.2", "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256", 
2048, 4},
+                {"TLSv1.3", "TLS_AES_256_GCM_SHA384", 2048, 0},
+                {"TLSv1.3", "TLS_AES_256_GCM_SHA384", 2048, 4},
+        });
+    }
+
+    private final String protocol;
+    private final String[] cipherSuites;
+    private final int messageCount;
+    private final int messageLengthDelta;
+
+    public SslEnd2EndTest(String protocol, String cipherSuites, int 
messageCount, int messageLengthDelta) {
+        this.protocol = protocol;
+        this.cipherSuites = cipherSuites.split(",");
+        this.messageCount = messageCount;
+        this.messageLengthDelta = messageLengthDelta;
+    }
+
+    @Test
+    public void shouldSendLargeMessages() throws Throwable {
+        ByteBuffer acceptorReceiveBuffer = ByteBuffer.allocate(MAX_LENGTH);
+        AcceptorHandler acceptorHandler = new 
AcceptorHandler(acceptorReceiveBuffer);
+        IoAcceptor acceptor = createAcceptor(acceptorHandler);
+
+        try {
+            AcceptorBindUtil.tryBind(acceptor);
+
+            ByteBuffer connectorReceiveBuffer = 
ByteBuffer.allocate(MAX_LENGTH);
+            ConnectorIoHandler connectorHandler = new 
ConnectorIoHandler(connectorReceiveBuffer);
+            IoConnector connector = createConnector(connectorHandler);
+
+            try {
+                ConnectFuture connectFuture = 
connector.connect(acceptor.getLocalAddress());
+                assertTrue("Failed to connect", 
connectFuture.awaitUninterruptibly(4L, TimeUnit.SECONDS));
+
+                IoBuffer connectorSendBuffer = 
IoBuffer.wrap(ByteBuffer.allocate(MAX_LENGTH));
+
+                for (int i = 0; i < connectorSendBuffer.limit(); i += 4) {
+                    connectorSendBuffer.putInt(i);
+                }
+
+                connectorSendBuffer.flip();
+
+                IoSession session = connectFuture.getSession();
+                int messageLength = 65_536;
+
+                for (int i = 0; i < messageCount; i++) {
+                    if (messageLength > MAX_LENGTH) {
+                        throw new RuntimeException("Message length exceeds 
send buffer capacity. Increase send buffer capacity");
+                    }
+
+                    connectorSendBuffer.limit(messageLength);
+                    connectorSendBuffer.rewind();
+
+                    CountDownLatch acceptorMessageReceivedLatch = new 
CountDownLatch(1);
+                    acceptorHandler.reset(acceptorMessageReceivedLatch, 
messageLength);
+
+                    CountDownLatch connectorMessageReceivedLatch = new 
CountDownLatch(1);
+                    connectorHandler.reset(connectorMessageReceivedLatch, 
messageLength);
+
+                    WriteFuture writeFuture = 
session.write(connectorSendBuffer);
+                    assertTrue("Connector write failed", 
writeFuture.awaitUninterruptibly(4L, TimeUnit.SECONDS));
+
+                    boolean messageReceived = 
acceptorMessageReceivedLatch.await(4L, TimeUnit.SECONDS);
+
+                    if (!messageReceived) {
+                        assertNoException(acceptorHandler.getFailure());
+                        fail("Failed to receive from connector");
+                    }
+
+                    acceptorReceiveBuffer.flip();
+
+                    for (int j = 0; j < acceptorReceiveBuffer.limit(); j += 4) 
{
+                        assertEquals(j, acceptorReceiveBuffer.getInt());
+                    }
+
+                    boolean connectorMessageReceived = 
connectorMessageReceivedLatch.await(4L, TimeUnit.SECONDS);
+
+                    if (!connectorMessageReceived) {
+                        assertNoException(connectorHandler.getFailure());
+                        fail("Failed to receive from acceptor");
+                    }
+
+                    connectorReceiveBuffer.flip();
+
+                    for (int j = 0; j < connectorReceiveBuffer.limit(); j += 
4) {
+                        assertEquals(j, connectorReceiveBuffer.getInt());
+                    }
+
+                    messageLength += messageLengthDelta;
+                }
+            } finally {
+                connector.dispose();
+            }
+        } finally {
+            acceptor.unbind();
+            acceptor.dispose();
+        }
+    }
+
+    private void assertNoException(Throwable exception) throws Throwable {
+        if (exception != null) {
+            throw exception;
+        }
+    }
+
+    private IoAcceptor createAcceptor(IoHandler handler) throws Exception {
+        NioSocketAcceptor acceptor = new NioSocketAcceptor();
+        acceptor.setReuseAddress(true);
+        acceptor.setHandler(handler);
+
+        DefaultIoFilterChainBuilder filters = acceptor.getFilterChain();
+
+        SSLContext sslContext = createAcceptorSSLContext();
+
+        SslFilter sslFilter = new SslFilter(sslContext);
+        sslFilter.setEnabledCipherSuites(cipherSuites);
+        sslFilter.setEnabledProtocols(protocol);
+
+        filters.addLast("sslFilter", sslFilter);
+
+        return acceptor;
+    }
+
+    private IoConnector createConnector(IoHandler ioHandler) throws 
GeneralSecurityException, IOException {
+        NioSocketConnector connector = new NioSocketConnector();
+        connector.setHandler(ioHandler);
+
+        DefaultIoFilterChainBuilder filters = connector.getFilterChain();
+
+        SSLContext sslContext = createConnectorSslContext();
+
+        SslFilter sslFilter = new SslFilter(sslContext);
+        sslFilter.setEnabledCipherSuites(cipherSuites);
+        sslFilter.setEnabledProtocols(protocol);
+
+        filters.addLast("sslFilter", sslFilter);
+
+        return connector;
+    }
+
+    private SSLContext createAcceptorSSLContext() throws IOException, 
GeneralSecurityException {
+        char[] passphrase = "password".toCharArray();
+
+        SSLContext ctx = SSLContext.getInstance(protocol);
+        KeyManagerFactory kmf = 
KeyManagerFactory.getInstance(KEY_MANAGER_FACTORY_ALGORITHM);
+        TrustManagerFactory tmf = 
TrustManagerFactory.getInstance(KEY_MANAGER_FACTORY_ALGORITHM);
+
+        KeyStore ks = KeyStore.getInstance("JKS");
+        ks.load(SslEnd2EndTest.class.getResourceAsStream("keystore.jks"), 
passphrase);
+
+        KeyStore ts = KeyStore.getInstance("JKS");
+        
ts.load(SslEnd2EndTest.class.getResourceAsStream("emptykeystore.sslTest"), 
passphrase);
+
+        kmf.init(ks, passphrase);
+        tmf.init(ts);
+
+        ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+        return ctx;
+    }
+
+    private SSLContext createConnectorSslContext() throws IOException, 
GeneralSecurityException {
+        char[] passphrase = "password".toCharArray();
+
+        SSLContext ctx = SSLContext.getInstance(protocol);
+        KeyManagerFactory kmf = 
KeyManagerFactory.getInstance(KEY_MANAGER_FACTORY_ALGORITHM);
+        TrustManagerFactory tmf = 
TrustManagerFactory.getInstance(KEY_MANAGER_FACTORY_ALGORITHM);
+
+        KeyStore ks = KeyStore.getInstance("JKS");
+        
ks.load(SslEnd2EndTest.class.getResourceAsStream("emptykeystore.sslTest"), 
passphrase);
+
+        KeyStore ts = KeyStore.getInstance("JKS");
+        ts.load(SslEnd2EndTest.class.getResourceAsStream("truststore.jks"), 
passphrase);
+
+        kmf.init(ks, passphrase);
+        tmf.init(ts);
+
+        ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+        return ctx;
+    }
+
+    private static final class AcceptorHandler extends IoHandlerAdapter {
+
+        private static final Logger LOGGER = 
LoggerFactory.getLogger(AcceptorHandler.class);
+        private final ByteBuffer receiveBuffer;
+        private final AtomicReference<Throwable> exception;
+        private CountDownLatch messageReceivedLatch;
+        private int expectedLength;
+
+        private AcceptorHandler(ByteBuffer receiveBuffer) {
+            this.receiveBuffer = receiveBuffer;
+            this.exception = new AtomicReference<>();
+        }
+
+        public void reset(CountDownLatch messageReceivedLatch, int 
expectedLength) {
+            this.messageReceivedLatch = messageReceivedLatch;
+            this.receiveBuffer.clear();
+
+            // zero data
+            for (int i = 0; i < receiveBuffer.capacity(); i++) {
+                receiveBuffer.put(i, (byte) 0);
+            }
+
+            this.expectedLength = expectedLength;
+        }
+
+        public Throwable getFailure() {
+            return exception.get();
+        }
+
+        @Override
+        public void exceptionCaught(IoSession session, Throwable cause) {
+            if (LOGGER.isDebugEnabled()) {
+                LOGGER.debug("Exception caught: {}", session, cause);
+            }
+
+            exception.set(cause);

Review Comment:
   Record only the _first_ exception. Later exceptions may be unrelated to the 
test.



##########
mina-core/src/test/java/org/apache/mina/filter/ssl/SslEnd2EndTest.java:
##########
@@ -0,0 +1,364 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.filter.ssl;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
+import org.apache.mina.core.future.ConnectFuture;
+import org.apache.mina.core.future.WriteFuture;
+import org.apache.mina.core.service.IoAcceptor;
+import org.apache.mina.core.service.IoConnector;
+import org.apache.mina.core.service.IoHandler;
+import org.apache.mina.core.service.IoHandlerAdapter;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
+import org.apache.mina.transport.socket.nio.NioSocketConnector;
+import org.apache.mina.util.AcceptorBindUtil;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManagerFactory;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+import java.security.Security;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+@RunWith(Parameterized.class)
+public class SslEnd2EndTest {
+
+    private static final String KEY_MANAGER_FACTORY_ALGORITHM;
+    private static final int MAX_LENGTH = 1024 * 1024 * 8;
+
+    static {
+        String algorithm = 
Security.getProperty("ssl.KeyManagerFactory.algorithm");
+        if (algorithm == null) {
+            algorithm = KeyManagerFactory.getDefaultAlgorithm();
+        }
+
+        KEY_MANAGER_FACTORY_ALGORITHM = algorithm;
+    }
+
+    @Parameterized.Parameters(name = "{index}: {0} / {1} / {2} / {3}")
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][]{
+                {"TLSv1.2", "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256", 
2048, 0},
+                {"TLSv1.2", "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256", 
2048, 4},
+                {"TLSv1.3", "TLS_AES_256_GCM_SHA384", 2048, 0},
+                {"TLSv1.3", "TLS_AES_256_GCM_SHA384", 2048, 4},
+        });
+    }
+
+    private final String protocol;
+    private final String[] cipherSuites;
+    private final int messageCount;
+    private final int messageLengthDelta;
+
+    public SslEnd2EndTest(String protocol, String cipherSuites, int 
messageCount, int messageLengthDelta) {
+        this.protocol = protocol;
+        this.cipherSuites = cipherSuites.split(",");
+        this.messageCount = messageCount;
+        this.messageLengthDelta = messageLengthDelta;
+    }
+
+    @Test
+    public void shouldSendLargeMessages() throws Throwable {
+        ByteBuffer acceptorReceiveBuffer = ByteBuffer.allocate(MAX_LENGTH);
+        AcceptorHandler acceptorHandler = new 
AcceptorHandler(acceptorReceiveBuffer);
+        IoAcceptor acceptor = createAcceptor(acceptorHandler);
+
+        try {
+            AcceptorBindUtil.tryBind(acceptor);
+
+            ByteBuffer connectorReceiveBuffer = 
ByteBuffer.allocate(MAX_LENGTH);
+            ConnectorIoHandler connectorHandler = new 
ConnectorIoHandler(connectorReceiveBuffer);
+            IoConnector connector = createConnector(connectorHandler);
+
+            try {
+                ConnectFuture connectFuture = 
connector.connect(acceptor.getLocalAddress());
+                assertTrue("Failed to connect", 
connectFuture.awaitUninterruptibly(4L, TimeUnit.SECONDS));
+
+                IoBuffer connectorSendBuffer = 
IoBuffer.wrap(ByteBuffer.allocate(MAX_LENGTH));
+
+                for (int i = 0; i < connectorSendBuffer.limit(); i += 4) {
+                    connectorSendBuffer.putInt(i);
+                }
+
+                connectorSendBuffer.flip();
+
+                IoSession session = connectFuture.getSession();
+                int messageLength = 65_536;
+
+                for (int i = 0; i < messageCount; i++) {
+                    if (messageLength > MAX_LENGTH) {
+                        throw new RuntimeException("Message length exceeds 
send buffer capacity. Increase send buffer capacity");
+                    }
+
+                    connectorSendBuffer.limit(messageLength);
+                    connectorSendBuffer.rewind();
+
+                    CountDownLatch acceptorMessageReceivedLatch = new 
CountDownLatch(1);
+                    acceptorHandler.reset(acceptorMessageReceivedLatch, 
messageLength);
+
+                    CountDownLatch connectorMessageReceivedLatch = new 
CountDownLatch(1);
+                    connectorHandler.reset(connectorMessageReceivedLatch, 
messageLength);
+
+                    WriteFuture writeFuture = 
session.write(connectorSendBuffer);
+                    assertTrue("Connector write failed", 
writeFuture.awaitUninterruptibly(4L, TimeUnit.SECONDS));
+
+                    boolean messageReceived = 
acceptorMessageReceivedLatch.await(4L, TimeUnit.SECONDS);
+
+                    if (!messageReceived) {
+                        assertNoException(acceptorHandler.getFailure());
+                        fail("Failed to receive from connector");
+                    }
+
+                    acceptorReceiveBuffer.flip();
+
+                    for (int j = 0; j < acceptorReceiveBuffer.limit(); j += 4) 
{
+                        assertEquals(j, acceptorReceiveBuffer.getInt());
+                    }
+
+                    boolean connectorMessageReceived = 
connectorMessageReceivedLatch.await(4L, TimeUnit.SECONDS);
+
+                    if (!connectorMessageReceived) {
+                        assertNoException(connectorHandler.getFailure());
+                        fail("Failed to receive from acceptor");
+                    }
+
+                    connectorReceiveBuffer.flip();
+
+                    for (int j = 0; j < connectorReceiveBuffer.limit(); j += 
4) {
+                        assertEquals(j, connectorReceiveBuffer.getInt());
+                    }
+
+                    messageLength += messageLengthDelta;
+                }
+            } finally {
+                connector.dispose();
+            }
+        } finally {
+            acceptor.unbind();
+            acceptor.dispose();
+        }
+    }
+
+    private void assertNoException(Throwable exception) throws Throwable {
+        if (exception != null) {
+            throw exception;

Review Comment:
   A failed assertion throws an `AssertionError`. This should be `throw new 
AssertionError(exception);`.



##########
mina-core/src/test/java/org/apache/mina/filter/ssl/SslEnd2EndTest.java:
##########
@@ -0,0 +1,364 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.filter.ssl;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
+import org.apache.mina.core.future.ConnectFuture;
+import org.apache.mina.core.future.WriteFuture;
+import org.apache.mina.core.service.IoAcceptor;
+import org.apache.mina.core.service.IoConnector;
+import org.apache.mina.core.service.IoHandler;
+import org.apache.mina.core.service.IoHandlerAdapter;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
+import org.apache.mina.transport.socket.nio.NioSocketConnector;
+import org.apache.mina.util.AcceptorBindUtil;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManagerFactory;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+import java.security.Security;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+@RunWith(Parameterized.class)
+public class SslEnd2EndTest {
+
+    private static final String KEY_MANAGER_FACTORY_ALGORITHM;
+    private static final int MAX_LENGTH = 1024 * 1024 * 8;
+
+    static {
+        String algorithm = 
Security.getProperty("ssl.KeyManagerFactory.algorithm");
+        if (algorithm == null) {
+            algorithm = KeyManagerFactory.getDefaultAlgorithm();
+        }
+
+        KEY_MANAGER_FACTORY_ALGORITHM = algorithm;
+    }
+
+    @Parameterized.Parameters(name = "{index}: {0} / {1} / {2} / {3}")
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][]{
+                {"TLSv1.2", "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256", 
2048, 0},
+                {"TLSv1.2", "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256", 
2048, 4},
+                {"TLSv1.3", "TLS_AES_256_GCM_SHA384", 2048, 0},
+                {"TLSv1.3", "TLS_AES_256_GCM_SHA384", 2048, 4},
+        });
+    }
+
+    private final String protocol;
+    private final String[] cipherSuites;
+    private final int messageCount;
+    private final int messageLengthDelta;
+
+    public SslEnd2EndTest(String protocol, String cipherSuites, int 
messageCount, int messageLengthDelta) {
+        this.protocol = protocol;
+        this.cipherSuites = cipherSuites.split(",");
+        this.messageCount = messageCount;
+        this.messageLengthDelta = messageLengthDelta;
+    }
+
+    @Test
+    public void shouldSendLargeMessages() throws Throwable {
+        ByteBuffer acceptorReceiveBuffer = ByteBuffer.allocate(MAX_LENGTH);
+        AcceptorHandler acceptorHandler = new 
AcceptorHandler(acceptorReceiveBuffer);
+        IoAcceptor acceptor = createAcceptor(acceptorHandler);
+
+        try {
+            AcceptorBindUtil.tryBind(acceptor);
+
+            ByteBuffer connectorReceiveBuffer = 
ByteBuffer.allocate(MAX_LENGTH);
+            ConnectorIoHandler connectorHandler = new 
ConnectorIoHandler(connectorReceiveBuffer);
+            IoConnector connector = createConnector(connectorHandler);
+
+            try {
+                ConnectFuture connectFuture = 
connector.connect(acceptor.getLocalAddress());
+                assertTrue("Failed to connect", 
connectFuture.awaitUninterruptibly(4L, TimeUnit.SECONDS));
+
+                IoBuffer connectorSendBuffer = 
IoBuffer.wrap(ByteBuffer.allocate(MAX_LENGTH));
+
+                for (int i = 0; i < connectorSendBuffer.limit(); i += 4) {
+                    connectorSendBuffer.putInt(i);
+                }
+
+                connectorSendBuffer.flip();
+
+                IoSession session = connectFuture.getSession();
+                int messageLength = 65_536;
+
+                for (int i = 0; i < messageCount; i++) {
+                    if (messageLength > MAX_LENGTH) {
+                        throw new RuntimeException("Message length exceeds 
send buffer capacity. Increase send buffer capacity");
+                    }
+
+                    connectorSendBuffer.limit(messageLength);
+                    connectorSendBuffer.rewind();
+
+                    CountDownLatch acceptorMessageReceivedLatch = new 
CountDownLatch(1);
+                    acceptorHandler.reset(acceptorMessageReceivedLatch, 
messageLength);
+
+                    CountDownLatch connectorMessageReceivedLatch = new 
CountDownLatch(1);
+                    connectorHandler.reset(connectorMessageReceivedLatch, 
messageLength);
+
+                    WriteFuture writeFuture = 
session.write(connectorSendBuffer);
+                    assertTrue("Connector write failed", 
writeFuture.awaitUninterruptibly(4L, TimeUnit.SECONDS));
+
+                    boolean messageReceived = 
acceptorMessageReceivedLatch.await(4L, TimeUnit.SECONDS);
+
+                    if (!messageReceived) {
+                        assertNoException(acceptorHandler.getFailure());
+                        fail("Failed to receive from connector");
+                    }
+
+                    acceptorReceiveBuffer.flip();
+
+                    for (int j = 0; j < acceptorReceiveBuffer.limit(); j += 4) 
{
+                        assertEquals(j, acceptorReceiveBuffer.getInt());
+                    }
+
+                    boolean connectorMessageReceived = 
connectorMessageReceivedLatch.await(4L, TimeUnit.SECONDS);
+
+                    if (!connectorMessageReceived) {
+                        assertNoException(connectorHandler.getFailure());
+                        fail("Failed to receive from acceptor");
+                    }
+
+                    connectorReceiveBuffer.flip();
+
+                    for (int j = 0; j < connectorReceiveBuffer.limit(); j += 
4) {
+                        assertEquals(j, connectorReceiveBuffer.getInt());
+                    }
+
+                    messageLength += messageLengthDelta;
+                }
+            } finally {
+                connector.dispose();
+            }
+        } finally {
+            acceptor.unbind();
+            acceptor.dispose();
+        }
+    }
+
+    private void assertNoException(Throwable exception) throws Throwable {
+        if (exception != null) {
+            throw exception;
+        }
+    }
+
+    private IoAcceptor createAcceptor(IoHandler handler) throws Exception {
+        NioSocketAcceptor acceptor = new NioSocketAcceptor();
+        acceptor.setReuseAddress(true);
+        acceptor.setHandler(handler);
+
+        DefaultIoFilterChainBuilder filters = acceptor.getFilterChain();
+
+        SSLContext sslContext = createAcceptorSSLContext();
+
+        SslFilter sslFilter = new SslFilter(sslContext);
+        sslFilter.setEnabledCipherSuites(cipherSuites);
+        sslFilter.setEnabledProtocols(protocol);
+
+        filters.addLast("sslFilter", sslFilter);
+
+        return acceptor;
+    }
+
+    private IoConnector createConnector(IoHandler ioHandler) throws 
GeneralSecurityException, IOException {
+        NioSocketConnector connector = new NioSocketConnector();
+        connector.setHandler(ioHandler);
+
+        DefaultIoFilterChainBuilder filters = connector.getFilterChain();
+
+        SSLContext sslContext = createConnectorSslContext();
+
+        SslFilter sslFilter = new SslFilter(sslContext);
+        sslFilter.setEnabledCipherSuites(cipherSuites);
+        sslFilter.setEnabledProtocols(protocol);
+
+        filters.addLast("sslFilter", sslFilter);
+
+        return connector;
+    }
+
+    private SSLContext createAcceptorSSLContext() throws IOException, 
GeneralSecurityException {
+        char[] passphrase = "password".toCharArray();
+
+        SSLContext ctx = SSLContext.getInstance(protocol);
+        KeyManagerFactory kmf = 
KeyManagerFactory.getInstance(KEY_MANAGER_FACTORY_ALGORITHM);
+        TrustManagerFactory tmf = 
TrustManagerFactory.getInstance(KEY_MANAGER_FACTORY_ALGORITHM);
+
+        KeyStore ks = KeyStore.getInstance("JKS");
+        ks.load(SslEnd2EndTest.class.getResourceAsStream("keystore.jks"), 
passphrase);
+
+        KeyStore ts = KeyStore.getInstance("JKS");
+        
ts.load(SslEnd2EndTest.class.getResourceAsStream("emptykeystore.sslTest"), 
passphrase);
+
+        kmf.init(ks, passphrase);
+        tmf.init(ts);
+
+        ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+        return ctx;
+    }
+
+    private SSLContext createConnectorSslContext() throws IOException, 
GeneralSecurityException {
+        char[] passphrase = "password".toCharArray();
+
+        SSLContext ctx = SSLContext.getInstance(protocol);
+        KeyManagerFactory kmf = 
KeyManagerFactory.getInstance(KEY_MANAGER_FACTORY_ALGORITHM);
+        TrustManagerFactory tmf = 
TrustManagerFactory.getInstance(KEY_MANAGER_FACTORY_ALGORITHM);
+
+        KeyStore ks = KeyStore.getInstance("JKS");
+        
ks.load(SslEnd2EndTest.class.getResourceAsStream("emptykeystore.sslTest"), 
passphrase);
+
+        KeyStore ts = KeyStore.getInstance("JKS");
+        ts.load(SslEnd2EndTest.class.getResourceAsStream("truststore.jks"), 
passphrase);
+
+        kmf.init(ks, passphrase);
+        tmf.init(ts);
+
+        ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+        return ctx;
+    }
+
+    private static final class AcceptorHandler extends IoHandlerAdapter {
+
+        private static final Logger LOGGER = 
LoggerFactory.getLogger(AcceptorHandler.class);
+        private final ByteBuffer receiveBuffer;
+        private final AtomicReference<Throwable> exception;
+        private CountDownLatch messageReceivedLatch;
+        private int expectedLength;
+
+        private AcceptorHandler(ByteBuffer receiveBuffer) {
+            this.receiveBuffer = receiveBuffer;
+            this.exception = new AtomicReference<>();
+        }
+
+        public void reset(CountDownLatch messageReceivedLatch, int 
expectedLength) {
+            this.messageReceivedLatch = messageReceivedLatch;
+            this.receiveBuffer.clear();
+
+            // zero data
+            for (int i = 0; i < receiveBuffer.capacity(); i++) {
+                receiveBuffer.put(i, (byte) 0);
+            }
+
+            this.expectedLength = expectedLength;
+        }
+
+        public Throwable getFailure() {
+            return exception.get();
+        }
+
+        @Override
+        public void exceptionCaught(IoSession session, Throwable cause) {
+            if (LOGGER.isDebugEnabled()) {
+                LOGGER.debug("Exception caught: {}", session, cause);
+            }
+
+            exception.set(cause);
+        }
+
+        @Override
+        public void messageReceived(IoSession session, Object message) {
+            IoBuffer messageBuffer = (IoBuffer) message;
+            receiveBuffer.put(messageBuffer.buf());
+
+            if (receiveBuffer.position() == expectedLength) {
+                receiveBuffer.flip();
+
+                // respond with the same message
+                IoBuffer buffer = IoBuffer.wrap(receiveBuffer);
+                session.write(buffer);
+
+                messageReceivedLatch.countDown();
+            }
+        }
+    }
+
+    private static final class ConnectorIoHandler extends IoHandlerAdapter {
+
+        private static final Logger LOGGER = 
LoggerFactory.getLogger(ConnectorIoHandler.class);
+
+        private final ByteBuffer receiveBuffer;
+        private final AtomicReference<Throwable> exception;
+        private CountDownLatch messageReceivedLatch;
+        private int expectedLength;
+
+        private ConnectorIoHandler(ByteBuffer receiveBuffer) {
+            this.receiveBuffer = receiveBuffer;
+            this.exception = new AtomicReference<>();
+        }
+
+        public Throwable getFailure() {
+            return exception.get();
+        }
+
+        public void reset(CountDownLatch messageReceivedLatch, int 
expectedLength) {
+            this.messageReceivedLatch = messageReceivedLatch;
+            this.receiveBuffer.clear();
+
+            // zero data
+            for (int i = 0; i < receiveBuffer.capacity(); i++) {
+                receiveBuffer.put(i, (byte) 0);
+            }
+
+            this.expectedLength = expectedLength;
+        }
+
+        @Override
+        public void exceptionCaught(IoSession session, Throwable cause) {
+            if (LOGGER.isDebugEnabled()) {
+                LOGGER.debug("Exception caught: {}", session, cause);
+            }
+            
+            exception.set(cause);

Review Comment:
   Same here: record only the first exception. Later exceptions are less 
interesting; it's the first one that'll make the message reception time out and 
close the session.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 1046535)
    Time Spent: 5.5h  (was: 5h 20m)

> Still having issue when dealing with TLS exchanges
> --------------------------------------------------
>
>                 Key: DIRMINA-1199
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1199
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 2.2.9
>            Reporter: Emmanuel Lécharny
>            Priority: Blocker
>         Attachments: SslFilterTest.java
>
>          Time Spent: 5.5h
>  Remaining Estimate: 0h
>
> When using TLS sessions in Apache DS, we are still facing errors:
>  
> {code:java}
> [08:17:14] DEBUG [org.apache.directory.api.ldap.codec.api.SaslFilter-] - 
> Message received:  HeapBuffer@575fd43e[pos=0 lim=16384 cap=50040: 00 00 FF 4E 
> F7 4E 80 85 0B 59 39 C1 A9 80 C9 E8]
> [08:17:14] DEBUG [org.apache.directory.api.ldap.codec.api.SaslFilter-] - 
> Partial SASL message received:  16380/65358
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@18a79b83[mode=server, connected=true] forward_received() - 
> received HeapBuffer@3bd3b4f5[pos=0 lim=16384 cap=33360: 40 A9 14 26 7A 1C 0B 
> FD 75 B1 3A 0C A2 E2 56 08]
> [08:17:14] DEBUG [org.apache.directory.api.ldap.codec.api.SaslFilter-] - 
> Message received:  HeapBuffer@3bd3b4f5[pos=0 lim=16384 cap=33360: 40 A9 14 26 
> 7A 1C 0B FD 75 B1 3A 0C A2 E2 56 08]
> [08:17:14] DEBUG [org.apache.directory.api.ldap.codec.api.SaslFilter-] - 
> Partial SASL message received:  32764/65358
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@18a79b83[mode=server, connected=true] forward_received() - 
> received HeapBuffer@7dc70c6b[pos=0 lim=16384 cap=16680: EB 43 18 7E A1 A2 3A 
> 36 67 14 D3 D0 87 6B 06 0C]
> [08:17:14] DEBUG [org.apache.directory.api.ldap.codec.api.SaslFilter-] - 
> Message received:  HeapBuffer@7dc70c6b[pos=0 lim=16384 cap=16680: EB 43 18 7E 
> A1 A2 3A 36 67 14 D3 D0 87 6B 06 0C]
> [08:17:14] DEBUG [org.apache.directory.api.ldap.codec.api.SaslFilter-] - 
> Partial SASL message received:  49148/65358
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslFilter-] - SERVER: Session 
> (0x00000001: nio socket, server, localhost/127.0.0.1:64618 => 
> /127.0.0.1:64617) received HeapBuffer@e33fa4a[pos=0 lim=65536 cap=65536: 17 
> 03 03 3F 6A 00 00 00 00 00 00 00 10 B4 A7 45]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@18a79b83[mode=server, connected=true] receive() - message 
> HeapBuffer@e33fa4a[pos=0 lim=65536 cap=65536: 17 03 03 3F 6A 00 00 00 00 00 
> 00 00 10 B4 A7 45]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@18a79b83[mode=server, connected=true] receive_loop() - source 
> HeapBuffer@e33fa4a[pos=0 lim=65536 cap=65536: 17 03 03 3F 6A 00 00 00 00 00 
> 00 00 10 B4 A7 45]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@18a79b83[mode=server, connected=true] receive_loop() - 
> bytes-consumed 16239, bytes-produced 16210, status OK, handshake 
> NOT_HANDSHAKING
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@18a79b83[mode=server, connected=true] receive_loop() - result 
> HeapBuffer@27e42196[pos=0 lim=16210 cap=66720: B6 B9 CE 9C FB 03 DF 94 98 05 
> 0C 17 B2 04 10 F7]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@18a79b83[mode=server, connected=true] receive_loop() - trying to 
> decode more messages, looping
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@18a79b83[mode=server, connected=true] receive_loop() - source 
> HeapBuffer@e33fa4a[pos=16239 lim=65536 cap=65536: 17 03 03 40 18 00 00 00 00 
> 00 00 00 12 C1 9E 57]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@18a79b83[mode=server, connected=true] forward_received() - 
> received HeapBuffer@27e42196[pos=0 lim=16210 cap=66720: B6 B9 CE 9C FB 03 DF 
> 94 98 05 0C 17 B2 04 10 F7]
> [08:17:14] DEBUG [org.apache.directory.api.ldap.codec.api.SaslFilter-] - 
> Message received:  HeapBuffer@27e42196[pos=0 lim=16210 cap=66720: B6 B9 CE 9C 
> FB 03 DF 94 98 05 0C 17 B2 04 10 F7]
> [08:17:14] DEBUG [org.apache.directory.api.ldap.codec.api.SaslFilter-] - Will 
> use SASL to unwrap received message of length:  65358
> [08:17:14] DEBUG [org.apache.directory.api.ldap.codec.api.SaslFilter-] - 
> Sending encrypted token of length 65362.
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslFilter-] - CLIENT: Session 
> (0x00000002: nio socket, client, /127.0.0.1:64618 => 
> localhost/127.0.0.1:64617) write WriteRequest: HeapBuffer@39651a82[pos=0 
> lim=65362 cap=65362: 00 00 FF 4E 74 34 15 26 CB F1 BD A5 4A FE A2 03]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write() - source 
> WriteRequest: HeapBuffer@39651a82[pos=0 lim=65362 cap=65362: 00 00 FF 4E 74 
> 34 15 26 CB F1 BD A5 4A FE A2 03]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - source 
> WriteRequest: HeapBuffer@39651a82[pos=0 lim=65362 cap=65362: 00 00 FF 4E 74 
> 34 15 26 CB F1 BD A5 4A FE A2 03]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - 
> bytes-consumed 16384, bytes-produced 16413, status OK, handshake 
> NOT_HANDSHAKING
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - result 
> WriteRequest: HeapBuffer@6be7bf6d[pos=0 lim=16413 cap=66836: 17 03 03 40 18 
> 00 00 00 00 00 00 00 15 28 27 29]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - source 
> WriteRequest: HeapBuffer@39651a82[pos=0 lim=65362 cap=65362: 00 00 FF 4E 74 
> 34 15 26 CB F1 BD A5 4A FE A2 03]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - 
> bytes-consumed 16384, bytes-produced 16413, status OK, handshake 
> NOT_HANDSHAKING
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - result 
> WriteRequest: HeapBuffer@134c370e[pos=0 lim=16413 cap=50127: 17 03 03 40 18 
> 00 00 00 00 00 00 00 16 16 4F AD]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - source 
> WriteRequest: HeapBuffer@39651a82[pos=0 lim=65362 cap=65362: 00 00 FF 4E 74 
> 34 15 26 CB F1 BD A5 4A FE A2 03]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - 
> bytes-consumed 16384, bytes-produced 16413, status OK, handshake 
> NOT_HANDSHAKING
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - result 
> WriteRequest: HeapBuffer@33364212[pos=0 lim=16413 cap=33418: 17 03 03 40 18 
> 00 00 00 00 00 00 00 17 75 68 0E]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - source 
> WriteRequest: HeapBuffer@39651a82[pos=0 lim=65362 cap=65362: 00 00 FF 4E 74 
> 34 15 26 CB F1 BD A5 4A FE A2 03]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - 
> bytes-consumed 16210, bytes-produced 16239, status OK, handshake 
> NOT_HANDSHAKING
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - result 
> WriteRequest: HeapBuffer@2216effc[pos=0 lim=16239 cap=33418: 17 03 03 3F 6A 
> 00 00 00 00 00 00 00 18 34 DB 4C]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] forward_writes() - writing 
> WriteRequest: HeapBuffer@6be7bf6d[pos=0 lim=16413 cap=66836: 17 03 03 40 18 
> 00 00 00 00 00 00 00 15 28 27 29]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] forward_writes() - writing 
> WriteRequest: HeapBuffer@134c370e[pos=0 lim=16413 cap=50127: 17 03 03 40 18 
> 00 00 00 00 00 00 00 16 16 4F AD]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] forward_writes() - writing 
> WriteRequest: HeapBuffer@33364212[pos=0 lim=16413 cap=33418: 17 03 03 40 18 
> 00 00 00 00 00 00 00 17 75 68 0E]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] forward_writes() - writing 
> WriteRequest: HeapBuffer@2216effc[pos=0 lim=16239 cap=33418: 17 03 03 3F 6A 
> 00 00 00 00 00 00 00 18 34 DB 4C]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslFilter-] - CLIENT: Session 
> (0x00000002: nio socket, client, /127.0.0.1:64618 => 
> localhost/127.0.0.1:64617) ack WriteRequest: HeapBuffer@6be7bf6d[pos=0 
> lim=16413 cap=66836: 17 03 03 40 18 00 00 00 00 00 00 00 15 28 27 29]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] ack() - accepted 
> WriteRequest: HeapBuffer@6be7bf6d[pos=0 lim=16413 cap=66836: 17 03 03 40 18 
> 00 00 00 00 00 00 00 15 28 27 29]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] ack() - checking to see if 
> any messages can be flushed
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] flush() - no saved messages
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslFilter-] - CLIENT: Session 
> (0x00000002: nio socket, client, /127.0.0.1:64618 => 
> localhost/127.0.0.1:64617) ack WriteRequest: HeapBuffer@134c370e[pos=0 
> lim=16413 cap=50127: 17 03 03 40 18 00 00 00 00 00 00 00 16 16 4F AD]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] ack() - accepted 
> WriteRequest: HeapBuffer@134c370e[pos=0 lim=16413 cap=50127: 17 03 03 40 18 
> 00 00 00 00 00 00 00 16 16 4F AD]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] ack() - checking to see if 
> any messages can be flushed
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] flush() - no saved messages
> [08:17:14] DEBUG [org.apache.mina.filter.codec.ProtocolCodecFilter-] - 
> Processing a MESSAGE_RECEIVED for session 1
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslFilter-] - CLIENT: Session 
> (0x00000002: nio socket, client, /127.0.0.1:64618 => 
> localhost/127.0.0.1:64617) ack WriteRequest: HeapBuffer@33364212[pos=0 
> lim=16413 cap=33418: 17 03 03 40 18 00 00 00 00 00 00 00 17 75 68 0E]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] ack() - accepted 
> WriteRequest: HeapBuffer@33364212[pos=0 lim=16413 cap=33418: 17 03 03 40 18 
> 00 00 00 00 00 00 00 17 75 68 0E]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] ack() - checking to see if 
> any messages can be flushed
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] flush() - no saved messages
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslFilter-] - CLIENT: Session 
> (0x00000002: nio socket, client, /127.0.0.1:64618 => 
> localhost/127.0.0.1:64617) ack WriteRequest: HeapBuffer@2216effc[pos=0 
> lim=16239 cap=33418: 17 03 03 3F 6A 00 00 00 00 00 00 00 18 34 DB 4C]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] ack() - accepted 
> WriteRequest: HeapBuffer@2216effc[pos=0 lim=16239 cap=33418: 17 03 03 3F 6A 
> 00 00 00 00 00 00 00 18 34 DB 4C]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] ack() - checking to see if 
> any messages can be flushed
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] flush() - no saved messages
> [08:17:14] DEBUG [org.apache.directory.api.ldap.codec.api.SaslFilter-] - 
> Sending encrypted token of length 65362.
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslFilter-] - CLIENT: Session 
> (0x00000002: nio socket, client, /127.0.0.1:64618 => 
> localhost/127.0.0.1:64617) write WriteRequest: HeapBuffer@745c2004[pos=0 
> lim=65362 cap=65362: 00 00 FF 4E C3 BD 4E BB A1 34 51 77 DE 14 C3 EB]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write() - source 
> WriteRequest: HeapBuffer@745c2004[pos=0 lim=65362 cap=65362: 00 00 FF 4E C3 
> BD 4E BB A1 34 51 77 DE 14 C3 EB]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - source 
> WriteRequest: HeapBuffer@745c2004[pos=0 lim=65362 cap=65362: 00 00 FF 4E C3 
> BD 4E BB A1 34 51 77 DE 14 C3 EB]
> [08:17:14] WARN [org.apache.directory.server.ldap.LdapProtocolHandler-] - 
> Unexpected exception forcing session to close: sending disconnect notice to 
> client.
> javax.net.ssl.SSLException: Tag mismatch!
>     at sun.security.ssl.Alert.createSSLException(Alert.java:133)
>     at sun.security.ssl.TransportContext.fatal(TransportContext.java:324)
>     at sun.security.ssl.TransportContext.fatal(TransportContext.java:267)
>     at sun.security.ssl.TransportContext.fatal(TransportContext.java:262)
>     at sun.security.ssl.SSLTransport.decode(SSLTransport.java:119)
>     at sun.security.ssl.SSLEngineImpl.decode(SSLEngineImpl.java:588)
>     at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:544)
>     at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:411)
>     at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:390)
>     at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:626)
>     at 
> org.apache.mina.filter.ssl.SSLHandlerG1.receive_loop(SSLHandlerG1.java:250)
>     at 
> org.apache.mina.filter.ssl.SSLHandlerG1.receive_loop(SSLHandlerG1.java:311)
>     at 
> org.apache.mina.filter.ssl.SSLHandlerG1.receive_start(SSLHandlerG1.java:201)
>     at org.apache.mina.filter.ssl.SSLHandlerG1.receive(SSLHandlerG1.java:179)
>     at 
> org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:441)
>     at 
> org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:650)
>     at 
> org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:49)
>     at 
> org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:1128)
>     at 
> org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:122)
>     at 
> org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:650)
>     at 
> org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:643)
>     at 
> org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:539)
>     at 
> org.apache.mina.core.polling.AbstractPollingIoProcessor.access$1200(AbstractPollingIoProcessor.java:68)
>     at 
> org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.process(AbstractPollingIoProcessor.java:1224)
>     at 
> org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.process(AbstractPollingIoProcessor.java:1213)
>     at 
> org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:683)
>     at 
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>     at java.lang.Thread.run(Thread.java:748)
> Caused by: javax.crypto.AEADBadTagException: Tag mismatch!
>     at 
> com.sun.crypto.provider.GaloisCounterMode.decryptFinal(GaloisCounterMode.java:620)
>     at com.sun.crypto.provider.CipherCore.finalNoPadding(CipherCore.java:1116)
>     at 
> com.sun.crypto.provider.CipherCore.fillOutputBuffer(CipherCore.java:1053)
>     at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:941)
>     at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:491)
>     at javax.crypto.CipherSpi.bufferCrypt(CipherSpi.java:779)
>     at javax.crypto.CipherSpi.engineDoFinal(CipherSpi.java:730)
>     at javax.crypto.Cipher.doFinal(Cipher.java:2463)
>     at 
> sun.security.ssl.SSLCipher$T12GcmReadCipherGenerator$GcmReadCipher.decrypt(SSLCipher.java:1606)
>     at 
> sun.security.ssl.SSLEngineInputRecord.decodeInputRecord(SSLEngineInputRecord.java:240)
>     at 
> sun.security.ssl.SSLEngineInputRecord.decode(SSLEngineInputRecord.java:197)
>     at 
> sun.security.ssl.SSLEngineInputRecord.decode(SSLEngineInputRecord.java:160)
>     at sun.security.ssl.SSLTransport.decode(SSLTransport.java:109)
>     ... 25 more
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - 
> bytes-consumed 16384, bytes-produced 16413, status OK, handshake 
> NOT_HANDSHAKING
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - result 
> WriteRequest: HeapBuffer@6da9dc6[pos=0 lim=16413 cap=66836: 17 03 03 40 18 00 
> 00 00 00 00 00 00 19 27 52 FA]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - source 
> WriteRequest: HeapBuffer@745c2004[pos=0 lim=65362 cap=65362: 00 00 FF 4E C3 
> BD 4E BB A1 34 51 77 DE 14 C3 EB]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - 
> bytes-consumed 16384, bytes-produced 16413, status OK, handshake 
> NOT_HANDSHAKING
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - result 
> WriteRequest: HeapBuffer@7fd69dd[pos=0 lim=16413 cap=50127: 17 03 03 40 18 00 
> 00 00 00 00 00 00 1A C0 45 B5]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - source 
> WriteRequest: HeapBuffer@745c2004[pos=0 lim=65362 cap=65362: 00 00 FF 4E C3 
> BD 4E BB A1 34 51 77 DE 14 C3 EB]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - 
> bytes-consumed 16384, bytes-produced 16413, status OK, handshake 
> NOT_HANDSHAKING
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - result 
> WriteRequest: HeapBuffer@12010fd1[pos=0 lim=16413 cap=33418: 17 03 03 40 18 
> 00 00 00 00 00 00 00 1B 69 6A 67]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - source 
> WriteRequest: HeapBuffer@745c2004[pos=0 lim=65362 cap=65362: 00 00 FF 4E C3 
> BD 4E BB A1 34 51 77 DE 14 C3 EB]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - 
> bytes-consumed 16210, bytes-produced 16239, status OK, handshake 
> NOT_HANDSHAKING
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] write_loop() - result 
> WriteRequest: HeapBuffer@7c84195[pos=0 lim=16239 cap=33418: 17 03 03 3F 6A 00 
> 00 00 00 00 00 00 1C DE D6 41]
> [08:17:14] DEBUG [org.apache.mina.filter.ssl.SslHandler-] - 
> SSLHandlerG1@49f42944[mode=client, connected=true] forward_writes() - writing 
> WriteRequest: HeapBuffer@6da9dc6[pos=0 lim=16413 cap=66836: 17 03 03 40 18 00 
> 00 00 00 00 00 00 19 27 52 FA]
> [08:17:14] DEBUG [org.apache.directory.api.ldap.codec.api.SaslFilter-] - 
> Filtering write request:  WriteRequest: MessageType : EXTENDED_RESPONSE
> Message ID : 0
>     Extended Response
>         ResponseName :'1.3.6.1.4.1.1466.20036'
>         Ldap Result
>             Result code : (PROTOCOL_ERROR) protocolError
>             Matched Dn : 'null'
>             Diagnostic message : 'PROTOCOL_ERROR: The server will 
> disconnect!' {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to