Skip to content

Commit

Permalink
[ISSUE apache#7042] maven-compile job failed, Because TlsTest's serve…
Browse files Browse the repository at this point in the history
…rRejectsSSLClient test case will throw TooLongFrameException (apache#7179)
  • Loading branch information
yao-wenbin authored Aug 18, 2023
1 parent 2b93e1e commit 05e7cde
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) {
case DISABLED:
ctx.close();
log.warn("Clients intend to establish an SSL connection while this server is running in SSL disabled mode");
break;
throw new UnsupportedOperationException("The NettyRemotingServer in SSL disabled mode doesn't support ssl client");
case PERMISSIVE:
case ENFORCING:
if (null != sslContext) {
Expand Down
14 changes: 12 additions & 2 deletions remoting/src/test/java/org/apache/rocketmq/remoting/TlsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,13 @@ else if ("noClientAuthFailure".equals(name.getMethodName())) {
tlsClientKeyPath = "";
tlsClientCertPath = "";
clientConfig.setUseTLS(false);
} else if ("serverRejectsSSLClient".equals(name.getMethodName())) {
} else if ("disabledServerRejectsSSLClient".equals(name.getMethodName())) {
tlsMode = TlsMode.DISABLED;
} else if ("disabledServerAcceptUnAuthClient".equals(name.getMethodName())) {
tlsMode = TlsMode.DISABLED;
tlsClientKeyPath = "";
tlsClientCertPath = "";
clientConfig.setUseTLS(false);
} else if ("reloadSslContextForServer".equals(name.getMethodName())) {
tlsClientAuthServer = false;
tlsServerNeedClientAuth = "none";
Expand Down Expand Up @@ -211,14 +216,19 @@ public void serverAcceptsUnAuthClient() throws Exception {
}

@Test
public void serverRejectsSSLClient() throws Exception {
public void disabledServerRejectsSSLClient() throws Exception {
try {
RemotingCommand response = remotingClient.invokeSync(getServerAddress(), createRequest(), 1000 * 5);
failBecauseExceptionWasNotThrown(RemotingSendRequestException.class);
} catch (RemotingSendRequestException ignore) {
}
}

@Test
public void disabledServerAcceptUnAuthClient() throws Exception {
requestThenAssertResponse();
}

/**
* Tests that a server configured to require client authentication refuses to accept connections
* from a client that has an untrusted certificate.
Expand Down

0 comments on commit 05e7cde

Please sign in to comment.