(geronimo-mail) 01/02: Update dependencies and migrate test harness to Apache James 3.9.0

[email protected] Fri, 17 Jul 2026 20:18:21 +0000
Newsgroups gmane.comp.java.geronimo.cvs
Message-ID <[email protected]>
This is an automated email from the ASF dual-hosted git repository.

rzo1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/geronimo-mail.git

commit 8922fd00d24298d3b6782ec6248fdd5c7097917a
Author: Richard Zowalla <[email protected]>
AuthorDate: Fri Jul 17 22:05:09 2026 +0200

    Update dependencies and migrate test harness to Apache James 3.9.0
    
    - Bump apache-mime4j-core to 0.8.14, geronimo-activation_2.0_spec to 1.0.0,
      geronimo-osgi-locator to 1.1, junit to 4.13.2, slf4j to 2.0.13
    - Replace James 3.0-beta4 test server stack with James 3.9.0 (in-memory
      mailbox, queue, users and domain list; Guice-based handler wiring)
    - Drop geronimo-javamail_1.6_spec: James 3.9 uses jakarta.mail, with
      jakarta.mail-api/Angus excluded so the spec and provider under test
      supply the Jakarta Mail classes and providers
    - Raise build target to Java 11 (compiler, enforcer, CI) as required by
      James 3.7+, and update maven-bundle-plugin to 5.1.9 for Java 11 class files
---
 .github/workflows/ci.yml                           |   2 +-
 .../geronimo-mail_2.1_provider/pom.xml             | 288 ++++++++-----
 .../apache/geronimo/mail/issues/IssuesTest.java    |   7 +-
 .../mail/store/imap/AuthenticationTest.java        |  12 +-
 .../geronimo/mail/testserver/ApopCmdHandler.java   |  71 ++--
 .../geronimo/mail/testserver/MailServer.java       | 468 ++++++++++-----------
 .../testserver/RefinedCoreCmdHandlerLoader.java    |  22 +-
 .../mail/testserver/RefinedJMXHandlersLoader.java  |  48 ---
 .../RefinedSmtpCoreCmdHandlerLoader.java           | 146 -------
 geronimo-mail_2.1_impl/pom.xml                     |  16 +-
 geronimo-mail_2.1_spec/pom.xml                     |  19 +-
 11 files changed, 484 insertions(+), 615 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 77d5412..46d44de 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -33,7 +33,7 @@ jobs:
     - name: Set up JDK
       uses: actions/setup-java@v4
       with:
-        java-version: '8'
+        java-version: '11'
         distribution: 'temurin'
 
     - name: Cache Maven packages
diff --git a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/pom.xml b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/pom.xml
index daa94c3..79efd23 100644
--- a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/pom.xml
+++ b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/pom.xml
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- 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 
+<!-- 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. -->
 
 <!-- $Rev$ $Date$ -->
@@ -27,7 +27,7 @@
     <name>Apache Geronimo Jakarta Mail 2.1 :: Impl :: Provider</name>
 
     <properties>
-        <james.version>3.0-beta4</james.version>
+        <james.version>3.9.0</james.version>
     </properties>
 
     <dependencies>
@@ -55,20 +55,31 @@
             <scope>test</scope>
         </dependency>
 
+        <!-- Embedded Apache James servers used as SMTP/POP3/IMAP endpoints for the tests.
+             jakarta.mail-api and the Angus implementation are excluded everywhere so that
+             the Jakarta Mail classes (and providers) under test come from
+             geronimo-mail_2.1_spec and this module only. -->
         <dependency>
             <groupId>org.apache.james</groupId>
-            <artifactId>apache-james-imap-processor</artifactId>
-            <version>0.3</version>
+            <artifactId>james-server-protocols-smtp</artifactId>
+            <version>${james.version}</version>
             <scope>test</scope>
             <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>jakarta.mail</groupId>
+                    <artifactId>jakarta.mail-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>jakarta.mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>angus-mail</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
 
-
         <dependency>
             <groupId>org.apache.james</groupId>
             <artifactId>james-server-protocols-pop3</artifactId>
@@ -76,8 +87,16 @@
             <scope>test</scope>
             <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>jakarta.mail</groupId>
+                    <artifactId>jakarta.mail-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>jakarta.mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>angus-mail</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
@@ -89,219 +108,292 @@
             <scope>test</scope>
             <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>jakarta.mail</groupId>
+                    <artifactId>jakarta.mail-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>jakarta.mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>angus-mail</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
 
         <dependency>
             <groupId>org.apache.james</groupId>
-            <artifactId>james-server-protocols-smtp</artifactId>
+            <artifactId>james-server-protocols-library</artifactId>
             <version>${james.version}</version>
             <scope>test</scope>
             <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>jakarta.mail</groupId>
+                    <artifactId>jakarta.mail-api</artifactId>
                 </exclusion>
-            </exclusions>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>apache-james-mailbox-memory</artifactId>
-            <version>0.5</version>
-            <scope>test</scope>
-            <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>jakarta.mail</artifactId>
                 </exclusion>
-            </exclusions>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>apache-james-mailbox-memory</artifactId>
-            <version>0.5</version>
-            <type>test-jar</type>
-            <scope>test</scope>
-            <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>angus-mail</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
 
+        <!-- MockProtocolHandlerLoader -->
         <dependency>
             <groupId>org.apache.james</groupId>
             <artifactId>james-server-protocols-library</artifactId>
+            <version>${james.version}</version>
             <type>test-jar</type>
             <scope>test</scope>
-            <version>${james.version}</version>
             <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>jakarta.mail</groupId>
+                    <artifactId>jakarta.mail-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>jakarta.mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>angus-mail</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
 
         <dependency>
             <groupId>org.apache.james</groupId>
-            <artifactId>james-server-protocols-library</artifactId>
-            <scope>test</scope>
+            <artifactId>apache-james-mailbox-memory</artifactId>
             <version>${james.version}</version>
+            <scope>test</scope>
             <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>jakarta.mail</groupId>
+                    <artifactId>jakarta.mail-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>jakarta.mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>angus-mail</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
 
+        <!-- InMemoryIntegrationResources -->
         <dependency>
             <groupId>org.apache.james</groupId>
-            <artifactId>james-server-filesystem-api</artifactId>
+            <artifactId>apache-james-mailbox-memory</artifactId>
+            <version>${james.version}</version>
             <type>test-jar</type>
             <scope>test</scope>
-            <version>${james.version}</version>
             <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>jakarta.mail</groupId>
+                    <artifactId>jakarta.mail-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>jakarta.mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>angus-mail</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
 
         <dependency>
             <groupId>org.apache.james</groupId>
-            <artifactId>james-server-data-library</artifactId>
-            <type>test-jar</type>
-            <scope>test</scope>
+            <artifactId>james-server-data-memory</artifactId>
             <version>${james.version}</version>
+            <scope>test</scope>
             <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>jakarta.mail</groupId>
+                    <artifactId>jakarta.mail-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>jakarta.mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>angus-mail</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
 
         <dependency>
             <groupId>org.apache.james</groupId>
-            <artifactId>james-server-data-library</artifactId>
-            <scope>test</scope>
+            <artifactId>james-server-mailrepository-memory</artifactId>
             <version>${james.version}</version>
+            <scope>test</scope>
             <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>jakarta.mail</groupId>
+                    <artifactId>jakarta.mail-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>jakarta.mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>angus-mail</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
 
         <dependency>
             <groupId>org.apache.james</groupId>
-            <artifactId>james-server-data-file</artifactId>
+            <artifactId>james-server-queue-memory</artifactId>
             <version>${james.version}</version>
             <scope>test</scope>
             <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>jakarta.mail</groupId>
+                    <artifactId>jakarta.mail-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>jakarta.mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>angus-mail</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
 
         <dependency>
             <groupId>org.apache.james</groupId>
-            <artifactId>james-server-queue-file</artifactId>
+            <artifactId>james-server-core</artifactId>
             <version>${james.version}</version>
             <scope>test</scope>
             <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>jakarta.mail</groupId>
+                    <artifactId>jakarta.mail-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>jakarta.mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>angus-mail</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
 
+        <!-- IntegrationResources, the base class of InMemoryIntegrationResources -->
         <dependency>
             <groupId>org.apache.james</groupId>
-            <artifactId>james-server-data-file</artifactId>
+            <artifactId>apache-james-mailbox-api</artifactId>
             <version>${james.version}</version>
             <type>test-jar</type>
             <scope>test</scope>
             <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>jakarta.mail</groupId>
+                    <artifactId>jakarta.mail-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>jakarta.mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>angus-mail</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
 
         <dependency>
             <groupId>org.apache.james</groupId>
-            <artifactId>james-server-queue-file</artifactId>
+            <artifactId>apache-james-mailbox-store</artifactId>
             <version>${james.version}</version>
             <type>test-jar</type>
             <scope>test</scope>
             <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>jakarta.mail</groupId>
+                    <artifactId>jakarta.mail-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>jakarta.mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>angus-mail</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
 
         <dependency>
             <groupId>org.apache.james</groupId>
-            <artifactId>james-server-queue-api</artifactId>
+            <artifactId>james-server-testing</artifactId>
             <version>${james.version}</version>
-            <type>test-jar</type>
             <scope>test</scope>
             <exclusions>
                 <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
+                    <groupId>jakarta.mail</groupId>
+                    <artifactId>jakarta.mail-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>jakarta.mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.angus</groupId>
+                    <artifactId>angus-mail</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
 
         <dependency>
             <groupId>org.apache.james</groupId>
-            <artifactId>james-server-data-api</artifactId>
+            <artifactId>event-bus-api</artifactId>
             <version>${james.version}</version>
             <type>test-jar</type>
             <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <artifactId>mail</artifactId>
-                    <groupId>javax.mail</groupId>
-                </exclusion>
-            </exclusions>
         </dependency>
+
+        <!-- used by MockProtocolHandlerLoader -->
+        <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+            <version>6.0.0</version>
+            <scope>test</scope>
+        </dependency>
+
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <version>1.7.2</version>
+            <groupId>org.apache.james</groupId>
+            <artifactId>metrics-tests</artifactId>
+            <version>${james.version}</version>
             <scope>test</scope>
         </dependency>
 
         <dependency>
             <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-simple</artifactId>
-            <version>1.7.2</version>
+            <artifactId>slf4j-api</artifactId>
+            <version>2.0.13</version>
             <scope>test</scope>
         </dependency>
 
         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-javamail_1.6_spec</artifactId>
-            <version>1.0.1</version>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <version>2.0.13</version>
             <scope>test</scope>
         </dependency>
 
@@ -346,8 +438,8 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
-                    <source>1.8</source>
-                    <target>1.8</target>
+                    <source>11</source>
+                    <target>11</target>
                 </configuration>
             </plugin>
         </plugins>
diff --git a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/issues/IssuesTest.java b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/issues/IssuesTest.java
index 107f32f..a0d25ef 100644
--- a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/issues/IssuesTest.java
+++ b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/issues/IssuesTest.java
@@ -103,8 +103,11 @@ public class IssuesTest extends AbstractProtocolTest {
             Properties props = new Properties();
             props.setProperty("mail.transport.protocol", "smtp");
             props.setProperty("mail.smtp.port", String.valueOf(smtpConf.getListenerPort()));
-            props.setProperty("mail.store.protocol", "imap");
-            props.setProperty("mail.imap.port", String.valueOf(imapConf.getListenerPort()));
+            // Retrieve via POP3: the raw MIME bytes round-trip unaltered, so the client-side
+            // filename decoding is what gets tested. James 3.9's IMAP BODYSTRUCTURE decodes
+            // encoded-word parameters on the server side and replaces non-ASCII with '?'.
+            props.setProperty("mail.store.protocol", "pop3");
+            props.setProperty("mail.pop3.port", String.valueOf(pop3Conf.getListenerPort()));
             //props.setProperty("mail.debug","true");
             Session session = Session.getInstance(props);
 
diff --git a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/store/imap/AuthenticationTest.java b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/store/imap/AuthenticationTest.java
index cc44657..6f9776c 100644
--- a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/store/imap/AuthenticationTest.java
+++ b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/store/imap/AuthenticationTest.java
@@ -33,7 +33,7 @@ import junit.framework.Assert;
 import junit.framework.TestCase;
 
 import org.apache.geronimo.mail.util.Base64;
-import org.apache.james.protocols.lib.PortUtil;
+import org.apache.geronimo.mail.testserver.MailServer;
 
 public class AuthenticationTest extends TestCase {
 
@@ -49,7 +49,7 @@ public class AuthenticationTest extends TestCase {
     
     public void testAuthenticatePlain() throws Exception {
 
-        final int listenerPort = PortUtil.getNonPrivilegedPort();
+        final int listenerPort = MailServer.acquirePort();
         //greenmail does not have AUTHENTICATE "PLAIN" support
         FakeImapAuthPlainServer fs = new FakeImapAuthPlainServer(null, "user", "pass");
         fs.startServer(listenerPort);
@@ -69,7 +69,7 @@ public class AuthenticationTest extends TestCase {
 
     public void testAuthenticatePlainFail() throws Exception {
 
-        final int listenerPort = PortUtil.getNonPrivilegedPort();
+        final int listenerPort = MailServer.acquirePort();
         //greenmail does not have AUTHENTICATE "PLAIN" support
         FakeImapAuthPlainServer fs = new FakeImapAuthPlainServer(null, "user", "pass");
         fs.startServer(listenerPort);
@@ -92,7 +92,7 @@ public class AuthenticationTest extends TestCase {
 
     public void testAuthenticatePlainAuthzid() throws Exception {
 
-        final int listenerPort = PortUtil.getNonPrivilegedPort();
+        final int listenerPort = MailServer.acquirePort();
         //greenmail does not have AUTHENTICATE "PLAIN" support
         FakeImapAuthPlainServer fs = new FakeImapAuthPlainServer("authzid", "user", "pass");
         fs.startServer(listenerPort);
@@ -113,7 +113,7 @@ public class AuthenticationTest extends TestCase {
 
 
     public void testAuthenticateOAuth2() throws Exception {
-        final int listenerPort = PortUtil.getNonPrivilegedPort();
+        final int listenerPort = MailServer.acquirePort();
         FakeImapAuthPlainServer fs = new FakeImapAuthPlainServer("", "user", "token");
         fs.startServer(listenerPort);
         // Setup mail session
@@ -140,7 +140,7 @@ public class AuthenticationTest extends TestCase {
     }
 
     public void testAuthenticateOAuth2Fail() throws Exception {
-        final int listenerPort = PortUtil.getNonPrivilegedPort();
+        final int listenerPort = MailServer.acquirePort();
         FakeImapAuthPlainServer fs = new FakeImapAuthPlainServer("", "user", "token");
         fs.startServer(listenerPort);
         // Setup mail session
diff --git a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/ApopCmdHandler.java b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/ApopCmdHandler.java
index 3305115..44d0fe5 100644
--- a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/ApopCmdHandler.java
+++ b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/ApopCmdHandler.java
@@ -21,37 +21,45 @@ import java.math.BigInteger;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 
-import javax.annotation.Resource;
+import jakarta.inject.Inject;
+import jakarta.inject.Named;
 
+import org.apache.james.core.Username;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
 import org.apache.james.mailbox.exception.BadCredentialsException;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.MailboxPath;
-import org.apache.james.pop3server.mailbox.MailboxAdapter;
+import org.apache.james.metrics.api.MetricFactory;
+import org.apache.james.pop3server.mailbox.MailboxAdapterFactory;
 import org.apache.james.protocols.api.Request;
 import org.apache.james.protocols.api.Response;
 import org.apache.james.protocols.lib.POP3BeforeSMTPHelper;
-import org.apache.james.protocols.lib.Slf4jLoggerAdapter;
 import org.apache.james.protocols.pop3.POP3Response;
 import org.apache.james.protocols.pop3.POP3Session;
 import org.apache.james.protocols.pop3.core.AbstractApopCmdHandler;
 import org.apache.james.protocols.pop3.mailbox.Mailbox;
 
-public class ApopCmdHandler extends AbstractApopCmdHandler  {
+import reactor.core.publisher.Mono;
 
-    private MailboxManager manager;
+public class ApopCmdHandler extends AbstractApopCmdHandler {
 
+    private final MailboxManager manager;
+    private final MailboxAdapterFactory mailboxAdapterFactory;
 
-    @Resource(name = "mailboxmanager")
-    public void setMailboxManager(MailboxManager manager) {
+    @Inject
+    public ApopCmdHandler(@Named("mailboxmanager") final MailboxManager manager,
+                          final MailboxAdapterFactory mailboxAdapterFactory,
+                          final MetricFactory metricFactory) {
+        super(metricFactory);
         this.manager = manager;
+        this.mailboxAdapterFactory = mailboxAdapterFactory;
     }
 
     @Override
-    public Response onCommand(POP3Session session, Request request) {
-        Response response =  super.onCommand(session, request);
+    public Response onCommand(final POP3Session session, final Request request) {
+        final Response response = super.onCommand(session, request);
         if (POP3Response.OK_RESPONSE.equals(response.getRetCode())) {
             POP3BeforeSMTPHelper.addIPAddress(session.getRemoteAddress().getAddress().getHostAddress());
         }
@@ -59,37 +67,31 @@ public class ApopCmdHandler extends AbstractApopCmdHandler  {
     }
 
     @Override
-    protected Mailbox auth(POP3Session session, String apopTimestamp, String user, String digest) throws Exception {
+    protected Mailbox auth(final POP3Session session, final String apopTimestamp, final Username user, final String digest) throws Exception {
+        final String plaintextpassword = MailServer.PASSWORD;
+
+        final String toHash = apopTimestamp.trim() + plaintextpassword;
+        if (!getMD5(toHash).equals(digest)) {
+            System.out.println("Digests does not match");
+            return null;
+        }
+
         MailboxSession mSession = null;
-        
-        String plaintextpassword = "serverpass";
-        
         try {
-            final String toHash = apopTimestamp.trim()+plaintextpassword;
-            
-            if(!getMD5(toHash).equals(digest))
-            {
-                System.out.println("Digests does not match");
-                return null;
-            }
-            
-            
-            session.setUser(user);
-            
-            mSession = manager.createSystemSession(session.getUser(), new Slf4jLoggerAdapter(session.getLogger()));
+            mSession = manager.createSystemSession(user);
             manager.startProcessingRequest(mSession);
-            MailboxPath inbox = MailboxPath.inbox(mSession);
-            
+            final MailboxPath inbox = MailboxPath.inbox(mSession);
+
             // check if the mailbox exists, if not create it
-            if (!manager.mailboxExists(inbox, mSession)) {
+            if (!Mono.from(manager.mailboxExists(inbox, mSession)).block()) {
                 manager.createMailbox(inbox, mSession);
             }
-            MessageManager mailbox = manager.getMailbox(MailboxPath.inbox(mSession), mSession);
-            return new MailboxAdapter(manager, mailbox, mSession);
-        } catch (BadCredentialsException e) {
+            final MessageManager mailbox = manager.getMailbox(inbox, mSession);
+            return mailboxAdapterFactory.create(mailbox, mSession);
+        } catch (final BadCredentialsException e) {
             return null;
-        } catch (MailboxException e) {
-            throw new IOException("Unable to access mailbox for user " + session.getUser(), e);
+        } catch (final MailboxException e) {
+            throw new IOException("Unable to access mailbox for user " + user.asString(), e);
         } finally {
             if (mSession != null) {
                 manager.endProcessingRequest(mSession);
@@ -97,7 +99,7 @@ public class ApopCmdHandler extends AbstractApopCmdHandler  {
         }
 
     }
-    
+
     private static String getMD5(final String input) {
         try {
             final MessageDigest md = MessageDigest.getInstance("MD5");
@@ -116,4 +118,3 @@ public class ApopCmdHandler extends AbstractApopCmdHandler  {
     }
 
 }
-
diff --git a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/MailServer.java b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/MailServer.java
index 040391c..6ee5d62 100644
--- a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/MailServer.java
+++ b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/MailServer.java
@@ -16,177 +16,165 @@
  */
 package org.apache.geronimo.mail.testserver;
 
-import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.InetAddress;
+import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.UnknownHostException;
+import java.time.Clock;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
+import java.util.Optional;
 import java.util.concurrent.Semaphore;
 
-import javax.mail.Flags;
-import javax.mail.internet.MimeMessage;
 import javax.net.ssl.SSLSocketFactory;
 
-import org.apache.commons.configuration.DefaultConfigurationBuilder;
+import jakarta.mail.internet.MimeMessage;
+
+import org.apache.commons.configuration2.BaseHierarchicalConfiguration;
+import org.apache.james.UserEntityValidator;
+import org.apache.james.core.Domain;
+import org.apache.james.core.Username;
 import org.apache.james.dnsservice.api.DNSService;
-import org.apache.james.domainlist.api.DomainListException;
-import org.apache.james.domainlist.api.mock.SimpleDomainList;
-import org.apache.james.filesystem.api.mock.MockFileSystem;
+import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.domainlist.lib.DomainListConfiguration;
+import org.apache.james.domainlist.memory.MemoryDomainList;
+import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.imap.encode.main.DefaultImapEncoderFactory;
-import org.apache.james.imap.encode.main.DefaultLocalizer;
 import org.apache.james.imap.main.DefaultImapDecoderFactory;
+import org.apache.james.imap.processor.fetch.FetchProcessor;
 import org.apache.james.imap.processor.main.DefaultImapProcessorFactory;
 import org.apache.james.imapserver.netty.IMAPServer;
+import org.apache.james.imapserver.netty.ImapMetrics;
+import org.apache.james.mailbox.Authorizator;
+import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
-import org.apache.james.mailbox.acl.GroupMembershipResolver;
-import org.apache.james.mailbox.acl.MailboxACLResolver;
-import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
-import org.apache.james.mailbox.acl.UnionMailboxACLResolver;
-import org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory;
-import org.apache.james.mailbox.model.MailboxConstants;
+import org.apache.james.mailbox.inmemory.InMemoryMailboxManager;
+import org.apache.james.mailbox.inmemory.manager.InMemoryIntegrationResources;
 import org.apache.james.mailbox.model.MailboxPath;
-import org.apache.james.mailbox.store.Authenticator;
-import org.apache.james.mailbox.store.StoreMailboxManager;
-import org.apache.james.mailrepository.mock.MockMailRepositoryStore;
+import org.apache.james.mailbox.store.StoreSubscriptionManager;
+import org.apache.james.mailrepository.api.MailRepositoryStore;
+import org.apache.james.mailrepository.api.Protocol;
+import org.apache.james.mailrepository.memory.MailRepositoryStoreConfiguration;
+import org.apache.james.mailrepository.memory.MemoryMailRepository;
+import org.apache.james.mailrepository.memory.MemoryMailRepositoryStore;
+import org.apache.james.mailrepository.memory.MemoryMailRepositoryUrlStore;
+import org.apache.james.mailrepository.memory.SimpleMailRepositoryLoader;
+import org.apache.james.metrics.api.MetricFactory;
+import org.apache.james.metrics.api.NoopGaugeRegistry;
+import org.apache.james.metrics.tests.RecordingMetricFactory;
+import org.apache.james.pop3server.mailbox.DefaultMailboxAdapterFactory;
+import org.apache.james.pop3server.mailbox.MailboxAdapterFactory;
 import org.apache.james.pop3server.netty.POP3Server;
-import org.apache.james.protocols.lib.PortUtil;
 import org.apache.james.protocols.lib.mock.MockProtocolHandlerLoader;
 import org.apache.james.queue.api.MailQueue;
-import org.apache.james.queue.api.MailQueue.MailQueueItem;
 import org.apache.james.queue.api.MailQueueFactory;
-import org.apache.james.queue.file.FileMailQueueFactory;
+import org.apache.james.queue.api.RawMailQueueItemDecoratorFactory;
+import org.apache.james.queue.memory.MemoryMailQueueFactory;
+import org.apache.james.rrt.api.AliasReverseResolver;
+import org.apache.james.rrt.api.CanSendFrom;
 import org.apache.james.rrt.api.RecipientRewriteTable;
-import org.apache.james.rrt.api.RecipientRewriteTableException;
+import org.apache.james.rrt.api.RecipientRewriteTableConfiguration;
+import org.apache.james.rrt.lib.AliasReverseResolverImpl;
+import org.apache.james.rrt.lib.CanSendFromImpl;
+import org.apache.james.rrt.memory.MemoryRecipientRewriteTable;
+import org.apache.james.server.core.filesystem.FileSystemImpl;
 import org.apache.james.smtpserver.netty.SMTPServer;
+import org.apache.james.smtpserver.netty.SmtpMetricsImpl;
+import org.apache.james.user.api.UsersRepository;
 import org.apache.james.user.api.UsersRepositoryException;
-import org.apache.james.user.lib.mock.MockUsersRepository;
-import org.apache.mailet.HostAddress;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.james.user.memory.MemoryUsersRepository;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.TypeLiteral;
+import com.google.inject.name.Names;
+
+import reactor.core.Disposable;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
 
 //James based POP3 or IMAP or SMTP server (for unittesting only)
 public class MailServer {
 
+    public static final String USER = "serveruser";
+    public static final String PASSWORD = "serverpass";
+
     private POP3Server pop3Server;
     private IMAPServer imapServer;
     private SMTPServer smtpServer;
+
     private AlterableDNSServer dnsServer;
-    private final MockUsersRepository usersRepository = new MockUsersRepository();
-    private final MockFileSystem fileSystem = new MockFileSystem();
+    private MemoryDomainList domainList;
+    private MemoryUsersRepository usersRepository;
+    private FileSystemImpl fileSystem;
     private MockProtocolHandlerLoader protocolHandlerChain;
-    private StoreMailboxManager<Long> mailboxManager;
+    private InMemoryIntegrationResources memoryIntegrationResources;
+    private InMemoryMailboxManager mailboxManager;
+    private MemoryMailRepositoryStore mailRepositoryStore;
+    private MemoryRecipientRewriteTable rewriteTable;
+    private MemoryMailQueueFactory queueFactory;
+    private MemoryMailQueueFactory.MemoryCacheableMailQueue queue;
+    private Disposable fetcher;
 
-    private MockMailRepositoryStore store;
-    private DNSService dnsService;
-    private MailQueueFactory queueFactory;
-    private MailQueue queue;
     private final Semaphore sem = new Semaphore(0);
-    private final Logger log = LoggerFactory.getLogger("Mock");
 
     public void ensureMsgCount(final int count) throws InterruptedException {
         sem.acquire(count);
     }
 
-    private class Fetcher extends Thread {
-
-        private final MailQueue queue;
-        private final MessageManager mailbox;
-        private final MailboxSession session;
-
-        Fetcher(final MailQueue queue, final MessageManager mailbox, final MailboxSession session) {
-            super();
-            this.queue = queue;
-            this.mailbox = mailbox;
-            this.session = session;
-        }
-
-        @Override
-        public void run() {
-            while (true) {
-                try {
-                    System.out.println("Await new mail ...");
-                    final MailQueueItem item = queue.deQueue();
-                    System.out.println("got it");
-                    final MimeMessage msg = item.getMail().getMessage();
-                    final ByteArrayOutputStream bout = new ByteArrayOutputStream();
-                    msg.writeTo(bout);
-                    mailbox.appendMessage(new ByteArrayInputStream(bout.toByteArray()), new Date(), session, true, new Flags());
-                    item.done(true);
-                    sem.release();
-                    System.out.println("mail copied over");
-                } catch (final Exception e) {
-                    e.printStackTrace();
-                    return;
-                }
-            }
-        }
-
-    }
-
-    public MailServer() {
-        super();
-        try {
-            usersRepository.addUser("serveruser", "serverpass");
-        } catch (final UsersRepositoryException e) {
-            throw new RuntimeException(e);
-        }
-
-    }
-
     public void start(final SmtpTestConfiguration smtpConfig, final Pop3TestConfiguration pop3Config, final ImapTestConfiguration imapConfig)
             throws Exception {
         setUpServiceManager();
 
-        imapServer = new IMAPServer();
+        final RecordingMetricFactory metricFactory = new RecordingMetricFactory();
 
-        imapServer.setImapEncoder(DefaultImapEncoderFactory.createDefaultEncoder(new DefaultLocalizer(), false));
-        imapServer.setImapDecoder(DefaultImapDecoderFactory.createDecoder());
+        smtpServer = new SMTPServer(new SmtpMetricsImpl(metricFactory));
+        smtpServer.setDnsService(dnsServer);
+        smtpServer.setFileSystem(fileSystem);
+        smtpServer.setProtocolHandlerLoader(protocolHandlerChain);
 
         pop3Server = new POP3Server();
+        pop3Server.setFileSystem(fileSystem);
         pop3Server.setProtocolHandlerLoader(protocolHandlerChain);
 
-        smtpServer = new SMTPServer() {
-            @Override
-            protected Class<? extends org.apache.james.protocols.lib.handler.HandlersPackage> getJMXHandlersPackage() {
-                return RefinedJMXHandlersLoader.class;
-            };
-
-        };
-        smtpServer.setProtocolHandlerLoader(protocolHandlerChain);
-        smtpServer.setDNSService(dnsServer);
-
+        imapServer = new IMAPServer(
+                new DefaultImapDecoderFactory().buildImapDecoder(),
+                new DefaultImapEncoderFactory().buildImapEncoder(),
+                DefaultImapProcessorFactory.createXListSupportingProcessor(
+                        mailboxManager,
+                        memoryIntegrationResources.getEventBus(),
+                        new StoreSubscriptionManager(mailboxManager.getMapperFactory(),
+                                mailboxManager.getMapperFactory(),
+                                mailboxManager.getEventBus()),
+                        null,
+                        memoryIntegrationResources.getQuotaManager(),
+                        memoryIntegrationResources.getQuotaRootResolver(),
+                        metricFactory,
+                        FetchProcessor.LocalCacheConfiguration.DEFAULT),
+                new ImapMetrics(metricFactory),
+                new NoopGaugeRegistry(),
+                ImmutableSet.of());
         imapServer.setFileSystem(fileSystem);
-        pop3Server.setFileSystem(fileSystem);
-        smtpServer.setFileSystem(fileSystem);
-
-        imapServer.setLog(log);
-        pop3Server.setLog(log);
-        smtpServer.setLog(log);
-
-        final MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, "serveruser", "INBOX");
-        final MailboxSession session = mailboxManager.login("serveruser", "serverpass", LoggerFactory.getLogger("Test"));
 
-        if (!mailboxManager.mailboxExists(mailboxPath, session)) {
+        final MailboxSession session = mailboxManager.createSystemSession(Username.of(USER));
+        final MailboxPath mailboxPath = MailboxPath.inbox(session);
+        if (!Mono.from(mailboxManager.mailboxExists(mailboxPath, session)).block()) {
             mailboxManager.createMailbox(mailboxPath, session);
         }
+        final MessageManager mailbox = mailboxManager.getMailbox(mailboxPath, session);
 
-        imapServer.setImapProcessor(DefaultImapProcessorFactory.createXListSupportingProcessor(mailboxManager, null, null));//new StoreSubscriptionManager(new InMemoryMailboxSessionMapperFactory()), null));
-
-        //setupTestMails(session, mailboxManager.getMailbox(mailboxPath, session));
-
-        new Fetcher(queue, mailboxManager.getMailbox(mailboxPath, session), session).start();
+        fetcher = Flux.from(queue.deQueue())
+                .publishOn(Schedulers.boundedElastic())
+                .subscribe(item -> deliver(item, mailbox, session));
 
         smtpConfig.init();
         pop3Config.init();
@@ -202,8 +190,30 @@ public class MailServer {
 
     }
 
+    private void deliver(final MailQueue.MailQueueItem item, final MessageManager mailbox, final MailboxSession session) {
+        try {
+            final MimeMessage msg = item.getMail().getMessage();
+            final ByteArrayOutputStream bout = new ByteArrayOutputStream();
+            msg.writeTo(bout);
+            mailbox.appendMessage(MessageManager.AppendCommand.builder().recent().build(bout.toByteArray()), session);
+            item.done(MailQueue.MailQueueItem.CompletionStatus.SUCCESS);
+            sem.release();
+        } catch (final Exception e) {
+            e.printStackTrace();
+            try {
+                item.done(MailQueue.MailQueueItem.CompletionStatus.RETRY);
+            } catch (final Exception ignored) {
+                // nothing left to do
+            }
+        }
+    }
+
     public void stop() throws Exception {
 
+        if (fetcher != null) {
+            fetcher.dispose();
+        }
+
         if (protocolHandlerChain != null) {
             protocolHandlerChain.dispose();
         }
@@ -222,129 +232,72 @@ public class MailServer {
 
     }
 
-    /* protected void setupTestMailsx(MailboxSession session, MessageManager mailbox) throws MailboxException {
-         mailbox.appendMessage(new ByteArrayInputStream(content), new Date(), session, true, new Flags());
-         byte[] content2 = ("EMPTY").getBytes();
-         mailbox.appendMessage(new ByteArrayInputStream(content2), new Date(), session, true, new Flags());
-     }*/
-
     protected void setUpServiceManager() throws Exception {
-        protocolHandlerChain = new MockProtocolHandlerLoader();
-        protocolHandlerChain.put("usersrepository", usersRepository);
-
-        final InMemoryMailboxSessionMapperFactory factory = new InMemoryMailboxSessionMapperFactory();
-        final MailboxACLResolver aclResolver = new UnionMailboxACLResolver();
-        final GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver();
-        mailboxManager = new StoreMailboxManager<Long>(factory, new Authenticator() {
-
-            public boolean isAuthentic(final String userid, final CharSequence passwd) {
-                try {
-                    return usersRepository.test(userid, passwd.toString());
-                } catch (final UsersRepositoryException e) {
-                    e.printStackTrace();
-                    return false;
-                }
-            }
-        }, aclResolver, groupMembershipResolver);
-        mailboxManager.init();
-
-        protocolHandlerChain.put("mailboxmanager", mailboxManager);
-
-        protocolHandlerChain.put("fileSystem", fileSystem);
-
-        //smtp
         dnsServer = new AlterableDNSServer();
-        store = new MockMailRepositoryStore();
-        protocolHandlerChain.put("mailStore", store);
-        protocolHandlerChain.put("dnsservice", dnsServer);
-        protocolHandlerChain.put("org.apache.james.smtpserver.protocol.DNSService", dnsService);
-
-        protocolHandlerChain.put("recipientrewritetable", new RecipientRewriteTable() {
 
-            public void addRegexMapping(final String user, final String domain, final String regex) throws RecipientRewriteTableException {
-                throw new UnsupportedOperationException("Not implemented");
-            }
-
-            public void removeRegexMapping(final String user, final String domain, final String regex)
-                    throws RecipientRewriteTableException {
-                throw new UnsupportedOperationException("Not implemented");
-            }
-
-            public void addAddressMapping(final String user, final String domain, final String address)
-                    throws RecipientRewriteTableException {
-                throw new UnsupportedOperationException("Not implemented");
-            }
-
-            public void removeAddressMapping(final String user, final String domain, final String address)
-                    throws RecipientRewriteTableException {
-                throw new UnsupportedOperationException("Not implemented");
-            }
-
-            public void addErrorMapping(final String user, final String domain, final String error) throws RecipientRewriteTableException {
-                throw new UnsupportedOperationException("Not implemented");
-            }
-
-            public void removeErrorMapping(final String user, final String domain, final String error)
-                    throws RecipientRewriteTableException {
-                throw new UnsupportedOperationException("Not implemented");
-            }
-
-            public Collection<String> getUserDomainMappings(final String user, final String domain) throws RecipientRewriteTableException {
-                throw new UnsupportedOperationException("Not implemented");
-            }
-
-            public void addMapping(final String user, final String domain, final String mapping) throws RecipientRewriteTableException {
-                throw new UnsupportedOperationException("Not implemented");
-            }
-
-            public void removeMapping(final String user, final String domain, final String mapping) throws RecipientRewriteTableException {
-                throw new UnsupportedOperationException("Not implemented");
-            }
-
-            public Map<String, Collection<String>> getAllMappings() throws RecipientRewriteTableException {
-                throw new UnsupportedOperationException("Not implemented");
-            }
-
-            public void addAliasDomainMapping(final String aliasDomain, final String realDomain) throws RecipientRewriteTableException {
-                throw new UnsupportedOperationException("Not implemented");
-            }
-
-            public void removeAliasDomainMapping(final String aliasDomain, final String realDomain) throws RecipientRewriteTableException {
-                throw new UnsupportedOperationException("Not implemented");
-            }
-
-            public Collection<String> getMappings(final String user, final String domain) throws ErrorMappingException,
-            RecipientRewriteTableException {
-                throw new UnsupportedOperationException("Not implemented");
-            }
-        });
-
-        protocolHandlerChain.put("org.apache.james.smtpserver.protocol.DNSService", dnsService);
-
-        final FileMailQueueFactory ff = new FileMailQueueFactory();// MockMailQueueFactory();
-        ff.setLog(log);
-        ff.setFileSystem(fileSystem);
-        queueFactory = ff;
-
-        queue = queueFactory.getQueue(MailQueueFactory.SPOOL);
-        protocolHandlerChain.put("mailqueuefactory", queueFactory);
-        protocolHandlerChain.put("domainlist", new SimpleDomainList() {
-
-            @Override
-            public String getDefaultDomain() {
-                return "localhost";
-            }
-
-            @Override
-            public String[] getDomains() throws DomainListException {
-                return new String[] { "localhost" };
-            }
-
-            @Override
-            public boolean containsDomain(final String serverName) {
-                return "localhost".equals(serverName);
-            }
-        });
+        domainList = new MemoryDomainList(dnsServer);
+        domainList.configure(DomainListConfiguration.DEFAULT);
+        if (!domainList.containsDomain(Domain.of("localhost"))) {
+            domainList.addDomain(Domain.of("localhost"));
+        }
+
+        usersRepository = MemoryUsersRepository.withoutVirtualHosting(domainList);
+        usersRepository.addUser(Username.of(USER), PASSWORD);
+
+        memoryIntegrationResources = InMemoryIntegrationResources.builder()
+                .authenticator((userid, passwd) -> {
+                    try {
+                        return usersRepository.test(userid, passwd.toString());
+                    } catch (final UsersRepositoryException e) {
+                        e.printStackTrace();
+                        return Optional.empty();
+                    }
+                })
+                .fakeAuthorizator()
+                .inVmEventBus()
+                .defaultAnnotationLimits()
+                .defaultMessageParser()
+                .scanningSearchIndex()
+                .noPreDeletionHooks()
+                .storeQuotaManager()
+                .build();
+        mailboxManager = memoryIntegrationResources.getMailboxManager();
+
+        fileSystem = FileSystemImpl.forTestingWithConfigurationFromClasspath();
+
+        final MemoryMailRepositoryUrlStore urlStore = new MemoryMailRepositoryUrlStore();
+        final MailRepositoryStoreConfiguration storeConfiguration = MailRepositoryStoreConfiguration.forItems(
+                new MailRepositoryStoreConfiguration.Item(
+                        ImmutableList.of(new Protocol("memory")),
+                        MemoryMailRepository.class.getName(),
+                        new BaseHierarchicalConfiguration()));
+        mailRepositoryStore = new MemoryMailRepositoryStore(urlStore, new SimpleMailRepositoryLoader(), storeConfiguration);
+        mailRepositoryStore.init();
+
+        rewriteTable = new MemoryRecipientRewriteTable();
+        rewriteTable.setConfiguration(RecipientRewriteTableConfiguration.DEFAULT_ENABLED);
+        final AliasReverseResolver aliasReverseResolver = new AliasReverseResolverImpl(rewriteTable);
+        final CanSendFrom canSendFrom = new CanSendFromImpl(aliasReverseResolver);
+
+        queueFactory = new MemoryMailQueueFactory(new RawMailQueueItemDecoratorFactory(), Clock.systemUTC());
+        queue = queueFactory.createQueue(MailQueueFactory.SPOOL);
+
+        protocolHandlerChain = MockProtocolHandlerLoader.builder()
+                .put(binder -> binder.bind(DomainList.class).toInstance(domainList))
+                .put(binder -> binder.bind(Clock.class).toInstance(Clock.systemUTC()))
+                .put(binder -> binder.bind(new TypeLiteral<MailQueueFactory<?>>() {}).toInstance(queueFactory))
+                .put(binder -> binder.bind(RecipientRewriteTable.class).toInstance(rewriteTable))
+                .put(binder -> binder.bind(CanSendFrom.class).toInstance(canSendFrom))
+                .put(binder -> binder.bind(FileSystem.class).toInstance(fileSystem))
+                .put(binder -> binder.bind(MailRepositoryStore.class).toInstance(mailRepositoryStore))
+                .put(binder -> binder.bind(DNSService.class).toInstance(dnsServer))
+                .put(binder -> binder.bind(UsersRepository.class).toInstance(usersRepository))
+                .put(binder -> binder.bind(MailboxManager.class).annotatedWith(Names.named("mailboxmanager")).toInstance(mailboxManager))
+                .put(binder -> binder.bind(MailboxAdapterFactory.class).to(DefaultMailboxAdapterFactory.class))
+                .put(binder -> binder.bind(MetricFactory.class).toInstance(new RecordingMetricFactory()))
+                .put(binder -> binder.bind(UserEntityValidator.class).toInstance(UserEntityValidator.NOOP))
+                .put(binder -> binder.bind(Authorizator.class).toInstance((userId, otherUserId) -> Authorizator.AuthorizationState.ALLOWED))
+                .build();
 
     }
 
@@ -355,6 +308,14 @@ public class MailServer {
         return queue;
     }
 
+    public static int acquirePort() {
+        try (ServerSocket socket = new ServerSocket(0)) {
+            return socket.getLocalPort();
+        } catch (final IOException e) {
+            throw new RuntimeException("Unable to allocate a free port", e);
+        }
+    }
+
     public static File getAbsoluteFilePathFromClassPath(final String fileNameFromClasspath) throws FileNotFoundException {
 
         File configFile = null;
@@ -362,34 +323,25 @@ public class MailServer {
         if (configURL != null) {
             try {
                 configFile = new File(configURL.toURI());
-            } catch (URISyntaxException e) {
+            } catch (final URISyntaxException e) {
                 configFile = new File(configURL.getPath());
             }
 
-            //Java 7 only
-            /*if(!configFile.exists()) {
-                try {
-                    configFile = Paths.get(configURL.toURI()).toFile();
-                } catch (URISyntaxException e) {
-                    throw new FileNotFoundException("Failed to load " + fileNameFromClasspath+ " due to "+e);
-                }
-            }*/
-
             if (configFile.exists()) {
                 return configFile;
             } else {
-                throw new FileNotFoundException("Cannot read from "+configFile.getAbsolutePath()+" (original resource was "+fileNameFromClasspath+", URL: "+configURL+"), because the file does not exist");
+                throw new FileNotFoundException("Cannot read from " + configFile.getAbsolutePath() + " (original resource was " + fileNameFromClasspath + ", URL: " + configURL + "), because the file does not exist");
             }
-            
+
         } else {
-            throw new FileNotFoundException("Failed to load " + fileNameFromClasspath+", because resource cannot be found within the classpath");
+            throw new FileNotFoundException("Failed to load " + fileNameFromClasspath + ", because resource cannot be found within the classpath");
         }
 
     }
 
-    public static abstract class AbstractTestConfiguration extends DefaultConfigurationBuilder {
+    public static abstract class AbstractTestConfiguration extends BaseHierarchicalConfiguration {
 
-        private final int listenerPort = PortUtil.getNonPrivilegedPort();
+        private final int listenerPort = acquirePort();
 
         /**
          * @return the listenerPort
@@ -403,7 +355,6 @@ public class MailServer {
             addProperty("tls.[@socketTLS]", enableSSL);
             addProperty("tls.keystore", "file://" + getAbsoluteFilePathFromClassPath("dummykeystore.jks").getAbsolutePath());
             addProperty("tls.secret", "123456");
-            addProperty("tls.provider", "org.bouncycastle.jce.provider.BouncyCastleProvider");
             return this;
         }
 
@@ -411,9 +362,9 @@ public class MailServer {
             addProperty("[@enabled]", true);
             addProperty("bind", "127.0.0.1:" + this.listenerPort);
             addProperty("connectiontimeout", "360000");
-            //addProperty("jmxName", getServertype().name()+"on"+this.listenerPort);
             addProperty("helloName", "jamesserver");
             addProperty("helloName.[@autodetect]", false);
+            addProperty("gracefulShutdown", false);
         }
 
     }
@@ -439,6 +390,7 @@ public class MailServer {
             super.init();
 
             addProperty("helloName", "imap on port " + getListenerPort());
+            addProperty("plainAuthDisallowed", false);
 
         }
 
@@ -449,7 +401,11 @@ public class MailServer {
         @Override
         public void init() {
             super.init();
-            addProperty("handlerchain.handler[@class]", RefinedSmtpCoreCmdHandlerLoader.class.getName());
+
+            addProperty("authorizedAddresses", "127.0.0.0/8");
+            addProperty("auth.requireSSL", false);
+            addProperty("verifyIdentity", false);
+            addProperty("handlerchain.[@coreHandlersPackage]", org.apache.james.smtpserver.CoreCmdHandlerLoader.class.getName());
 
         }
 
@@ -512,6 +468,7 @@ public class MailServer {
 
         private InetAddress localhostByName = null;
 
+        @Override
         public Collection<String> findMXRecords(final String hostname) {
             final List<String> res = new ArrayList<String>();
             if (hostname == null) {
@@ -523,14 +480,12 @@ public class MailServer {
             return res;
         }
 
-        public Iterator<HostAddress> getSMTPHostAddresses(final String domainName) {
-            throw new UnsupportedOperationException("Unimplemented mock service");
-        }
-
-        public InetAddress[] getAllByName(final String host) throws UnknownHostException {
-            return new InetAddress[] { getByName(host) };
+        @Override
+        public Collection<InetAddress> getAllByName(final String host) throws UnknownHostException {
+            return ImmutableList.of(getByName(host));
         }
 
+        @Override
         public InetAddress getByName(final String host) throws UnknownHostException {
             if (getLocalhostByName() != null) {
                 if ("127.0.0.1".equals(host)) {
@@ -551,13 +506,14 @@ public class MailServer {
             }
 
             if ("128.0.0.1".equals(host) || "192.168.0.1".equals(host) || "127.0.0.1".equals(host) || "127.0.0.0".equals(host)
-                    || "255.0.0.0".equals(host) || "255.255.255.255".equals(host)) {
+                    || "255.0.0.0".equals(host) || "255.255.255.255".equals(host) || "localhost".equals(host)) {
                 return InetAddress.getByName(host);
             }
 
             throw new UnsupportedOperationException("getByName not implemented in mock for host: " + host);
         }
 
+        @Override
         public Collection<String> findTXTRecords(final String hostname) {
             final List<String> res = new ArrayList<String>();
             if (hostname == null) {
@@ -578,10 +534,12 @@ public class MailServer {
             this.localhostByName = localhostByName;
         }
 
+        @Override
         public String getHostName(final InetAddress addr) {
             return addr.getHostName();
         }
 
+        @Override
         public InetAddress getLocalHost() throws UnknownHostException {
             return InetAddress.getLocalHost();
         }
diff --git a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/RefinedCoreCmdHandlerLoader.java b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/RefinedCoreCmdHandlerLoader.java
index 2041b55..fd65c92 100644
--- a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/RefinedCoreCmdHandlerLoader.java
+++ b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/RefinedCoreCmdHandlerLoader.java
@@ -16,16 +16,26 @@
  */
 package org.apache.geronimo.mail.testserver;
 
+import java.util.ArrayList;
+import java.util.List;
 
+import org.apache.james.pop3server.core.CoreCmdHandlerLoader;
+import org.apache.james.protocols.lib.handler.HandlersPackage;
 
-public class RefinedCoreCmdHandlerLoader extends org.apache.james.pop3server.core.CoreCmdHandlerLoader {
+/**
+ * The stock POP3 handler set plus APOP support.
+ */
+public class RefinedCoreCmdHandlerLoader implements HandlersPackage {
+
+    private final List<String> handlers = new ArrayList<>(new CoreCmdHandlerLoader().getHandlers());
 
     public RefinedCoreCmdHandlerLoader() {
-        super();
-        getHandlers().add(ApopCmdHandler.class.getName());
-        
+        handlers.add(ApopCmdHandler.class.getName());
+    }
+
+    @Override
+    public List<String> getHandlers() {
+        return handlers;
     }
-    
-    
 
 }
diff --git a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/RefinedJMXHandlersLoader.java b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/RefinedJMXHandlersLoader.java
deleted file mode 100644
index af4696d..0000000
--- a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/RefinedJMXHandlersLoader.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- *  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.geronimo.mail.testserver;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.james.protocols.lib.handler.HandlersPackage;
-import org.apache.james.smtpserver.jmx.CommandHandlerResultJMXMonitor;
-import org.apache.james.smtpserver.jmx.ConnectHandlerResultJMXMonitor;
-import org.apache.james.smtpserver.jmx.HookResultJMXMonitor;
-//import org.apache.james.smtpserver.jmx.LineHandlerResultJMXMonitor;
-
-public class RefinedJMXHandlersLoader implements HandlersPackage {
-
-    private final List<String> handlers = new ArrayList<String>();
-
-    public RefinedJMXHandlersLoader() {
-        handlers.add(ConnectHandlerResultJMXMonitor.class.getName());
-        handlers.add(CommandHandlerResultJMXMonitor.class.getName());
-        //handlers.add(LineHandlerResultJMXMonitor.class.getName());
-        handlers.add(HookResultJMXMonitor.class.getName());
-    }
-
-    /**
-     * @see org.apache.james.protocols.api.handler.HandlersPackage#getHandlers()
-     */
-    public List<String> getHandlers() {
-        return handlers;
-    }
-
-}
-
diff --git a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/RefinedSmtpCoreCmdHandlerLoader.java b/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/RefinedSmtpCoreCmdHandlerLoader.java
deleted file mode 100644
index b91cafa..0000000
--- a/geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/test/java/org/apache/geronimo/mail/testserver/RefinedSmtpCoreCmdHandlerLoader.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/**
- *  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.geronimo.mail.testserver;
-
- /****************************************************************
- * 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.                                           *
- ****************************************************************/
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.james.protocols.api.handler.CommandDispatcher;
-import org.apache.james.protocols.api.handler.CommandHandlerResultLogger;
-import org.apache.james.protocols.lib.handler.HandlersPackage;
-import org.apache.james.protocols.smtp.core.ExpnCmdHandler;
-import org.apache.james.protocols.smtp.core.HeloCmdHandler;
-import org.apache.james.protocols.smtp.core.HelpCmdHandler;
-import org.apache.james.protocols.smtp.core.NoopCmdHandler;
-import org.apache.james.protocols.smtp.core.PostmasterAbuseRcptHook;
-import org.apache.james.protocols.smtp.core.QuitCmdHandler;
-import org.apache.james.protocols.smtp.core.ReceivedDataLineFilter;
-import org.apache.james.protocols.smtp.core.RsetCmdHandler;
-import org.apache.james.protocols.smtp.core.VrfyCmdHandler;
-import org.apache.james.protocols.smtp.core.esmtp.AuthCmdHandler;
-import org.apache.james.protocols.smtp.core.esmtp.EhloCmdHandler;
-import org.apache.james.protocols.smtp.core.esmtp.MailSizeEsmtpExtension;
-import org.apache.james.protocols.smtp.core.esmtp.StartTlsCmdHandler;
-import org.apache.james.protocols.smtp.core.log.HookResultLogger;
-import org.apache.james.smtpserver.AddDefaultAttributesMessageHook;
-import org.apache.james.smtpserver.AuthRequiredToRelayRcptHook;
-import org.apache.james.smtpserver.DataLineJamesMessageHookHandler;
-import org.apache.james.smtpserver.JamesDataCmdHandler;
-import org.apache.james.smtpserver.JamesMailCmdHandler;
-import org.apache.james.smtpserver.JamesRcptCmdHandler;
-import org.apache.james.smtpserver.JamesWelcomeMessageHandler;
-import org.apache.james.smtpserver.SendMailHandler;
-import org.apache.james.smtpserver.SenderAuthIdentifyVerificationRcptHook;
-import org.apache.james.smtpserver.UsersRepositoryAuthHook;
-
-/**
- * This class represent the base command handlers which are shipped with james.
- */
-public class RefinedSmtpCoreCmdHandlerLoader implements HandlersPackage {
-
-    private final String COMMANDDISPATCHER = CommandDispatcher.class.getName();
-    private final String AUTHCMDHANDLER = AuthCmdHandler.class.getName();
-    private final String DATACMDHANDLER = JamesDataCmdHandler.class.getName();
-    private final String EHLOCMDHANDLER = EhloCmdHandler.class.getName();
-    private final String EXPNCMDHANDLER = ExpnCmdHandler.class.getName();
-    private final String HELOCMDHANDLER = HeloCmdHandler.class.getName();
-    private final String HELPCMDHANDLER = HelpCmdHandler.class.getName();
-    private final String MAILCMDHANDLER = JamesMailCmdHandler.class.getName();
-    private final String NOOPCMDHANDLER = NoopCmdHandler.class.getName();
-    private final String QUITCMDHANDLER = QuitCmdHandler.class.getName();
-    private final String RCPTCMDHANDLER = JamesRcptCmdHandler.class.getName();
-    private final String RSETCMDHANDLER = RsetCmdHandler.class.getName();
-    private final String VRFYCMDHANDLER = VrfyCmdHandler.class.getName();
-    private final String MAILSIZEHOOK = MailSizeEsmtpExtension.class.getName();
-    private final String WELCOMEMESSAGEHANDLER = JamesWelcomeMessageHandler.class.getName();
-    private final String USERSREPOSITORYAUTHHANDLER = UsersRepositoryAuthHook.class.getName();
-    private final String POSTMASTERABUSEHOOK = PostmasterAbuseRcptHook.class.getName();
-    private final String AUTHREQUIREDTORELAY = AuthRequiredToRelayRcptHook.class.getName();
-    private final String SENDERAUTHIDENTITYVERIFICATION = SenderAuthIdentifyVerificationRcptHook.class.getName();
-    private final String RECEIVEDDATALINEFILTER = ReceivedDataLineFilter.class.getName();
-    private final String DATALINEMESSAGEHOOKHANDLER = DataLineJamesMessageHookHandler.class.getName();
-    private final String STARTTLSHANDLER = StartTlsCmdHandler.class.getName();
-
-    // MessageHooks
-    private final String ADDDEFAULTATTRIBUTESHANDLER = AddDefaultAttributesMessageHook.class.getName();
-    private final String SENDMAILHANDLER = SendMailHandler.class.getName();
-
-    // logging stuff
-    private final String COMMANDHANDLERRESULTLOGGER = CommandHandlerResultLogger.class.getName();
-    private final String HOOKRESULTLOGGER = HookResultLogger.class.getName();
-
-    private final List<String> commands = new LinkedList<String>();
-
-    public RefinedSmtpCoreCmdHandlerLoader() {
-        // Insert the base commands in the Map
-        commands.add(WELCOMEMESSAGEHANDLER);
-        commands.add(COMMANDDISPATCHER);
-        commands.add(AUTHCMDHANDLER);
-        commands.add(DATACMDHANDLER);
-        commands.add(EHLOCMDHANDLER);
-        commands.add(EXPNCMDHANDLER);
-        commands.add(HELOCMDHANDLER);
-        commands.add(HELPCMDHANDLER);
-        commands.add(MAILCMDHANDLER);
-        commands.add(NOOPCMDHANDLER);
-        commands.add(QUITCMDHANDLER);
-        commands.add(RCPTCMDHANDLER);
-        commands.add(RSETCMDHANDLER);
-        commands.add(VRFYCMDHANDLER);
-        commands.add(MAILSIZEHOOK);
-        commands.add(USERSREPOSITORYAUTHHANDLER);
-        commands.add(AUTHREQUIREDTORELAY);
-        commands.add(SENDERAUTHIDENTITYVERIFICATION);
-        commands.add(POSTMASTERABUSEHOOK);
-        commands.add(RECEIVEDDATALINEFILTER);
-        commands.add(DATALINEMESSAGEHOOKHANDLER);
-        commands.add(STARTTLSHANDLER);
-        // Add the default messageHooks
-        commands.add(ADDDEFAULTATTRIBUTESHANDLER);
-        commands.add(SENDMAILHANDLER);
-
-        // Add logging stuff
-        commands.add(COMMANDHANDLERRESULTLOGGER);
-        commands.add(HOOKRESULTLOGGER);
-    }
-
-    /**
-     * @see org.apache.james.protocols.api.handler.HandlersPackage#getHandlers()
-     */
-    public List<String> getHandlers() {
-        return commands;
-    }
-}
-
diff --git a/geronimo-mail_2.1_impl/pom.xml b/geronimo-mail_2.1_impl/pom.xml
index 07d328d..151d6e9 100644
--- a/geronimo-mail_2.1_impl/pom.xml
+++ b/geronimo-mail_2.1_impl/pom.xml
@@ -52,20 +52,20 @@
             <dependency>
                 <groupId>org.apache.geronimo.specs</groupId>
                 <artifactId>geronimo-activation_2.0_spec</artifactId>
-                <version>1.0.0-M1</version>
+                <version>1.0.0</version>
             </dependency>
 
             <dependency>
                 <groupId>junit</groupId>
                 <artifactId>junit</artifactId>
-                <version>4.13.1</version>
+                <version>4.13.2</version>
             </dependency>
 
             <!-- INTERNAL -->
             <dependency>
                 <groupId>org.apache.geronimo.specs</groupId>
                 <artifactId>geronimo-osgi-locator</artifactId>
-                <version>1.0</version>
+                <version>1.1</version>
                 <scope>provided</scope>
             </dependency>
         </dependencies>
@@ -74,6 +74,12 @@
     <build>
         <pluginManagement>
             <plugins>
+                <plugin>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>maven-bundle-plugin</artifactId>
+                    <version>5.1.9</version>
+                </plugin>
+
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-shade-plugin</artifactId>
@@ -158,9 +164,9 @@
                         </goals>
                         <configuration>
                             <rules>
-                                <!-- Allow any Java >= 1.8 -->
+                                <!-- Allow any Java >= 11 -->
                                 <requireJavaVersion>
-                                    <version>[1.8,)</version>
+                                    <version>[11,)</version>
                                 </requireJavaVersion>
 
                                 <!-- Allow any Maven >= 2.0.7 -->
diff --git a/geronimo-mail_2.1_spec/pom.xml b/geronimo-mail_2.1_spec/pom.xml
index 9b2d3d5..df202a8 100644
--- a/geronimo-mail_2.1_spec/pom.xml
+++ b/geronimo-mail_2.1_spec/pom.xml
@@ -55,7 +55,7 @@
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-activation_2.0_spec</artifactId>
-            <version>1.0.0-M1</version>
+            <version>1.0.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -73,13 +73,13 @@
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-osgi-locator</artifactId>
-            <version>1.0</version>
+            <version>1.1</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.james</groupId>
             <artifactId>apache-mime4j-core</artifactId>
-            <version>0.8.12</version>
+            <version>0.8.14</version>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
@@ -96,8 +96,8 @@
                 <artifactId>maven-compiler-plugin</artifactId>
                 <version>3.6.1</version>
                 <configuration>
-                    <source>1.8</source>
-                    <target>1.8</target>
+                    <source>11</source>
+                    <target>11</target>
                 </configuration>
             </plugin>
             <plugin>
@@ -144,7 +144,7 @@
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
-                <version>3.5.0</version>
+                <version>5.1.9</version>
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${project.groupId}.${project.artifactId};singleton=true</Bundle-SymbolicName>
@@ -202,11 +202,4 @@
             </build>
         </profile>
     </profiles>
-
-    <repositories>
-        <repository>
-            <id>orgapachegeronimo-1153</id>
-            <url>https://repository.apache.org/content/repositories/orgapachegeronimo-1153/</url>
-        </repository>
-    </repositories>
 </project>