13
13
import com .marklogic .client .test .junit5 .RequiresML12 ;
14
14
import com .marklogic .mgmt .ManageClient ;
15
15
import 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 ;
17
20
import org .junit .jupiter .api .condition .DisabledOnJre ;
18
21
import org .junit .jupiter .api .condition .JRE ;
19
22
import org .junit .jupiter .api .extension .ExtendWith ;
@@ -119,7 +122,9 @@ void noSslContext() {
119
122
120
123
DatabaseClient .ConnectionResult result = client .checkConnection ();
121
124
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." );
123
128
assertEquals (403 , result .getStatusCode ());
124
129
125
130
ForbiddenUserException ex = assertThrows (ForbiddenUserException .class ,
@@ -133,6 +138,17 @@ void noSslContext() {
133
138
);
134
139
}
135
140
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
+
136
152
@ Test
137
153
void tLS13ClientWithTLS12Server () {
138
154
DatabaseClient client = buildTrustAllClientWithSSLProtocol (SSLUtil .DEFAULT_PROTOCOL );
0 commit comments