You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/03/16 11:25:32 UTC
[james-project] branch master updated: JAMES-3715 Test IMAP compression when combined with SSL
This is an automated email from the ASF dual-hosted git repository.
btellier 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 facd345 JAMES-3715 Test IMAP compression when combined with SSL
facd345 is described below
commit facd345f8fe9e2887bf0827d2d36a0b512de6ee1
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Tue Mar 15 09:48:16 2022 +0700
JAMES-3715 Test IMAP compression when combined with SSL
---
.../james/imapserver/netty/IMAPServerTest.java | 46 ++++++++++++++++++++++
.../src/test/resources/imapServerSSLCompress.xml | 20 ++++++++++
2 files changed, 66 insertions(+)
diff --git a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
index 5f0674b..010b4d5 100644
--- a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
+++ b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
@@ -346,6 +346,52 @@ class IMAPServerTest {
inbox.getMessageByUID(1);
}
+ }
+
+ @Nested
+ class CompressWithSSL {
+ IMAPServer imapServer;
+ private int port;
+
+ @BeforeEach
+ void beforeEach() throws Exception {
+ imapServer = createImapServer("imapServerSSLCompress.xml");
+ port = imapServer.getListenAddresses().get(0).getPort();
+ }
+
+ @AfterEach
+ void tearDown() {
+ imapServer.destroy();
+ }
+
+ @Test
+ void shouldNotThrowWhenCompressionEnabled() throws Exception {
+ InMemoryMailboxManager mailboxManager = memoryIntegrationResources.getMailboxManager();
+ MailboxSession mailboxSession = mailboxManager.createSystemSession(USER);
+ mailboxManager.createMailbox(
+ MailboxPath.inbox(USER),
+ mailboxSession);
+ mailboxManager.getMailbox(MailboxPath.inbox(USER), mailboxSession)
+ .appendMessage(MessageManager.AppendCommand.builder().build("header: value\r\n\r\nbody"), mailboxSession);
+
+ Properties props = new Properties();
+ props.put("mail.imaps.user", USER.asString());
+ props.put("mail.imaps.host", "127.0.0.1");
+ props.put("mail.imaps.auth.mechanisms", "LOGIN");
+ props.put("mail.imaps.compress.enable", true);
+ props.put("mail.imaps.ssl.enable", "true");
+ props.put("mail.imaps.ssl.trust", "*");
+ props.put("mail.imaps.ssl.checkserveridentity", "false");
+ final Session session = Session.getInstance(props);
+ final Store store = session.getStore("imaps");
+ store.connect("127.0.0.1", port, USER.asString(), USER_PASS);
+ final FetchProfile fetchProfile = new FetchProfile();
+ fetchProfile.add(FetchProfile.Item.ENVELOPE);
+ final IMAPFolder inbox = (IMAPFolder) store.getFolder("INBOX");
+ inbox.open(READ_WRITE);
+
+ inbox.getMessageByUID(1);
+ }
}
diff --git a/server/protocols/protocols-imap4/src/test/resources/imapServerSSLCompress.xml b/server/protocols/protocols-imap4/src/test/resources/imapServerSSLCompress.xml
new file mode 100644
index 0000000..5cb0bf4
--- /dev/null
+++ b/server/protocols/protocols-imap4/src/test/resources/imapServerSSLCompress.xml
@@ -0,0 +1,20 @@
+<imapserver enabled="true">
+ <jmxName>imapserver</jmxName>
+ <bind>0.0.0.0:0</bind>
+ <tls socketTLS="true" startTLS="false">
+ <keystore>classpath://keystore</keystore>
+ <secret>james72laBalle</secret>
+ <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+ <algorithm>SunX509</algorithm>
+ </tls>
+ <compress>true</compress>
+ <connectionBacklog>200</connectionBacklog>
+ <connectionLimit>0</connectionLimit>
+ <connectionLimitPerIP>0</connectionLimitPerIP>
+ <idleTimeInterval>120</idleTimeInterval>
+ <idleTimeIntervalUnit>SECONDS</idleTimeIntervalUnit>
+ <enableIdle>true</enableIdle>
+ <inMemorySizeLimit>64K</inMemorySizeLimit>
+ <literalSizeLimit>128K</literalSizeLimit>
+ <plainAuthDisallowed>false</plainAuthDisallowed>
+</imapserver>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org