1313import com .marklogic .client .test .junit5 .RequiresML12 ;
1414import com .marklogic .mgmt .ManageClient ;
1515import com .marklogic .mgmt .resource .appservers .ServerManager ;
16- import org .junit .jupiter .api .*;
16+ import org .junit .jupiter .api .AfterEach ;
17+ import org .junit .jupiter .api .Assertions ;
18+ import org .junit .jupiter .api .BeforeAll ;
19+ import org .junit .jupiter .api .Test ;
1720import org .junit .jupiter .api .condition .DisabledOnJre ;
1821import org .junit .jupiter .api .condition .JRE ;
1922import org .junit .jupiter .api .extension .ExtendWith ;
@@ -119,7 +122,9 @@ void noSslContext() {
119122
120123 DatabaseClient .ConnectionResult result = client .checkConnection ();
121124 assertEquals ("Forbidden" , result .getErrorMessage (), "MarkLogic is expected to return a 403 Forbidden when the " +
122- "user tries to access an HTTPS app server using HTTP" );
125+ "user tries to access an HTTPS app server using HTTP. This behavior changes in MarkLogic 12, and it may " +
126+ "be considered a bit surprising with MarkLogic 11 and earlier - that is, the user probably shouldn't get " +
127+ "any response back since a connection cannot be made without using SSL." );
123128 assertEquals (403 , result .getStatusCode ());
124129
125130 ForbiddenUserException ex = assertThrows (ForbiddenUserException .class ,
@@ -133,6 +138,17 @@ void noSslContext() {
133138 );
134139 }
135140
141+ @ ExtendWith (RequiresML12 .class )
142+ @ Test
143+ void noSslContextWithMarkLogic12 () {
144+ DatabaseClient client = Common .newClientBuilder ().build ();
145+
146+ MarkLogicIOException ex = assertThrows (MarkLogicIOException .class , () -> client .checkConnection ());
147+ assertTrue (ex .getMessage ().contains ("unexpected end of stream" ), "Per MLE-17505, a change in the openssl " +
148+ "library used by the server results in an IO exception when the client tries to connect to an " +
149+ "app server that requires SSL, but the client does not use SSL. Actual message: " + ex .getMessage ());
150+ }
151+
136152 @ Test
137153 void tLS13ClientWithTLS12Server () {
138154 DatabaseClient client = buildTrustAllClientWithSSLProtocol (SSLUtil .DEFAULT_PROTOCOL );
0 commit comments