This is an automated email from the ASF dual-hosted git repository.

quantranhong1999 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git


The following commit(s) were added to refs/heads/master by this push:
     new 5fd26d1b8c [BUILD] 
IMAPServerIDCommandTest::concurrentIdCommandsInTheSameSessionShouldSucceed was 
instable
5fd26d1b8c is described below

commit 5fd26d1b8c06f38a15a70902183ba7a4b6219371
Author: Benoit TELLIER <[email protected]>
AuthorDate: Sun Aug 23 11:25:15 2026 +0700

    [BUILD] 
IMAPServerIDCommandTest::concurrentIdCommandsInTheSameSessionShouldSucceed was 
instable
---
 .../james/imapserver/netty/IMAPServerIDCommandTest.java | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git 
a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerIDCommandTest.java
 
b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerIDCommandTest.java
index a26b53c7ef..8fb6bbdbd3 100644
--- 
a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerIDCommandTest.java
+++ 
b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerIDCommandTest.java
@@ -24,6 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import java.time.Duration;
 
 import org.apache.james.util.concurrency.ConcurrentTestRunner;
+import org.apache.james.utils.TestIMAPClient;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Test;
 
@@ -61,15 +62,21 @@ class IMAPServerIDCommandTest extends 
AbstractIMAPServerTest {
     }
 
     @Test
-    void concurrentIdCommandsInTheSameSessionShouldSucceed() throws Exception {
+    void concurrentIdCommandsShouldSucceed() throws Exception {
         imapServer = createImapServer("imapServer.xml");
+        int port = imapServer.getListenAddresses().getFirst().getPort();
 
-        testIMAPClient.connect("127.0.0.1", 
imapServer.getListenAddresses().getFirst().getPort());
+        // One client per thread: a single TestIMAPClient wraps one socket and 
one
+        // reader, so sharing it across threads interleaves the replies and a 
thread
+        // can read an empty string that belongs to nobody.
         ConcurrentTestRunner.builder()
             .operation((threadNumber, step) -> {
-                assertThat(testIMAPClient.sendCommand("ID (\"name\" \"Apache 
James\")"))
-                    .contains("* ID NIL")
-                    .contains("OK ID completed.");
+                try (TestIMAPClient client = new TestIMAPClient()) {
+                    client.connect("127.0.0.1", port);
+                    assertThat(client.sendCommand("ID (\"name\" \"Apache 
James\")"))
+                        .contains("* ID NIL")
+                        .contains("OK ID completed.");
+                }
             })
             .threadCount(20)
             .operationCount(1)


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

Reply via email to