Skip to content

Commit 4a7821c

Browse files
Merge branch 'apache:main' into main
2 parents 67528b1 + 04c367a commit 4a7821c

File tree

5 files changed

+132
-6
lines changed

5 files changed

+132
-6
lines changed

.asf.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
github:
18+
description: "Apache ActiveMQ Classic"
19+
homepage: https://activemq.apache.org/components/classic/
20+
labels:
21+
- apache
22+
- activemq
23+
- activemq-classic
24+
- messaging
25+
- broker
26+
- amqp
27+
- amqps
28+
- openwire
29+
- mqtt
30+
- stomp
31+
- java
32+
- jms
33+
enabled_merge_buttons:
34+
squash: true
35+
merge: true
36+
rebase: true
37+
autolink_jira:
38+
- AMQ
39+
notifications:
40+
41+
42+
pullrequests: [email protected]
43+
jira_options: link label worklog

activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectionView.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import javax.management.ObjectName;
2323

2424
import org.apache.activemq.broker.Connection;
25+
import org.apache.activemq.broker.TransportConnection;
2526
import org.apache.activemq.util.IOExceptionSupport;
2627

2728
public class ConnectionView implements ConnectionViewMBean {
@@ -196,4 +197,12 @@ public boolean isNetworkConnection() {
196197
public long getConnectedTimestamp() {
197198
return connection.getConnectedTimestamp();
198199
}
200+
201+
@Override
202+
public String getWireFormatInfo() {
203+
if(connection instanceof TransportConnection) {
204+
return ((TransportConnection)connection).getRemoteWireFormatInfo().toString();
205+
}
206+
return "WireFormatInfo not available";
207+
}
199208
}

activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,11 @@ public interface ConnectionViewMBean extends Service {
139139
*/
140140
@MBeanInfo("Time in ms since epoch when connection was established.")
141141
long getConnectedTimestamp();
142+
143+
/**
144+
* @return the WireFormatInfo information
145+
*/
146+
@MBeanInfo("WireFormatInfo for the connection")
147+
public String getWireFormatInfo();
148+
142149
}

activemq-unit-tests/src/test/java/org/apache/activemq/ActiveMQSslConnectionFactoryTest.java

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,29 @@
2020
import java.io.ByteArrayOutputStream;
2121
import java.io.FileInputStream;
2222
import java.io.IOException;
23+
import java.lang.reflect.Field;
24+
import java.net.Socket;
2325
import java.security.KeyStore;
2426
import java.security.SecureRandom;
2527
import java.security.UnrecoverableKeyException;
2628

2729
import javax.net.ssl.KeyManager;
2830
import javax.net.ssl.KeyManagerFactory;
31+
import javax.net.ssl.SSLSocket;
2932
import javax.net.ssl.TrustManager;
3033
import javax.net.ssl.TrustManagerFactory;
3134

3235
import org.apache.activemq.broker.BrokerService;
3336
import org.apache.activemq.broker.SslBrokerService;
37+
import org.apache.activemq.transport.Transport;
38+
import org.apache.activemq.transport.TransportFilter;
39+
import org.apache.activemq.transport.tcp.SslTransport;
40+
import org.apache.activemq.transport.tcp.TcpTransport;
3441
import org.apache.commons.logging.Log;
3542
import org.apache.commons.logging.LogFactory;
3643

44+
import static org.junit.Assert.assertArrayEquals;
45+
3746
public class ActiveMQSslConnectionFactoryTest extends CombinationTestSupport {
3847
private static final Log LOG = LogFactory.getLog(ActiveMQSslConnectionFactoryTest.class);
3948

@@ -72,6 +81,26 @@ public void testCreateTcpConnectionUsingKnownPort() throws Exception {
7281
brokerStop();
7382
}
7483

84+
public void testCreateTcpConnectionWithSocketParameters() throws Exception {
85+
// Control case: check that the factory can create an ordinary (non-ssl) connection.
86+
String tcpUri = "tcp://localhost:61610?socket.OOBInline=true&socket.keepAlive=true&tcpNoDelay=true";
87+
broker = createBroker(tcpUri);
88+
89+
// This should create the connection.
90+
ActiveMQSslConnectionFactory cf = getFactory(tcpUri);
91+
connection = (ActiveMQConnection)cf.createConnection();
92+
assertNotNull(connection);
93+
94+
Socket socket = getSocketFromConnection(connection);
95+
assertTrue(socket.getOOBInline());
96+
assertTrue(socket.getKeepAlive());
97+
assertTrue(socket.getTcpNoDelay());
98+
99+
connection.start();
100+
connection.stop();
101+
brokerStop();
102+
}
103+
75104
public void testCreateFailoverTcpConnectionUsingKnownPort() throws Exception {
76105
// Control case: check that the factory can create an ordinary (non-ssl) connection.
77106
broker = createBroker("tcp://localhost:61610?wireFormat.tcpNoDelayEnabled=true");
@@ -103,6 +132,30 @@ public void testCreateSslConnection() throws Exception {
103132
brokerStop();
104133
}
105134

135+
public void testCreateSslConnectionWithSocketParameters() throws Exception {
136+
// Create SSL/TLS connection with trusted cert from truststore.
137+
String sslUri = "ssl://localhost:61611?socket.enabledProtocols=TLSv1.3&socket.enableSessionCreation=true&socket.needClientAuth=true";
138+
broker = createSslBroker(sslUri);
139+
assertNotNull(broker);
140+
141+
// This should create the connection.
142+
ActiveMQSslConnectionFactory cf = getFactory(sslUri);
143+
cf.setTrustStore("server.keystore");
144+
cf.setTrustStorePassword("password");
145+
connection = (ActiveMQConnection)cf.createConnection();
146+
assertNotNull(connection);
147+
148+
SSLSocket socket = (SSLSocket) getSocketFromConnection(connection);
149+
String[] expectedProtocols = {"TLSv1.3"};
150+
assertArrayEquals(expectedProtocols, socket.getEnabledProtocols());
151+
assertTrue(socket.getEnableSessionCreation());
152+
assertTrue(socket.getNeedClientAuth());
153+
154+
connection.start();
155+
connection.stop();
156+
brokerStop();
157+
}
158+
106159
public void testCreateSslConnectionKeyStore() throws Exception {
107160
// Create SSL/TLS connection with trusted cert from truststore.
108161
String sslUri = "ssl://localhost:61611";
@@ -371,4 +424,18 @@ private static Throwable getRootCause(Throwable throwable) {
371424
return rootCause;
372425
}
373426

427+
private Socket getSocketFromConnection(ActiveMQConnection connection) throws Exception {
428+
Transport transport = connection.getTransport();
429+
while(!(transport instanceof TcpTransport)) {
430+
transport = ((TransportFilter) transport).getNext();
431+
}
432+
Class<?> transportClass = transport.getClass();
433+
if (transport instanceof SslTransport) {
434+
transportClass = transportClass.getSuperclass();
435+
}
436+
Field socket = transportClass.getDeclaredField("socket");
437+
socket.setAccessible(true);
438+
return (Socket) socket.get(transport);
439+
}
440+
374441
}

pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
<commons-beanutils-version>1.9.4</commons-beanutils-version>
5151
<commons-collections-version>3.2.2</commons-collections-version>
5252
<commons-daemon-version>1.4.0</commons-daemon-version>
53-
<commons-dbcp2-version>2.12.0</commons-dbcp2-version>
54-
<commons-io-version>2.17.0</commons-io-version>
53+
<commons-dbcp2-version>2.13.0</commons-dbcp2-version>
54+
<commons-io-version>2.18.0</commons-io-version>
5555
<commons-lang-version>3.14.0</commons-lang-version>
5656
<commons-logging-version>1.3.4</commons-logging-version>
5757
<commons-pool2-version>2.12.0</commons-pool2-version>
@@ -65,14 +65,14 @@
6565
<httpclient-version>4.5.14</httpclient-version>
6666
<httpcore-version>4.4.16</httpcore-version>
6767
<insight-version>1.2.0.Beta4</insight-version>
68-
<jackson-version>2.18.1</jackson-version>
68+
<jackson-version>2.18.2</jackson-version>
6969
<jakarta-jms-api-version>3.1.0</jakarta-jms-api-version>
7070
<jasypt-version>1.9.3</jasypt-version>
7171
<jaxb-version>4.0.5</jaxb-version>
7272
<jaxb-bundle-version>2.3.2_1</jaxb-bundle-version>
7373
<jetty-version>11.0.24</jetty-version>
7474
<jetty-version-range>[11,13)</jetty-version-range>
75-
<jmdns-version>3.5.12</jmdns-version>
75+
<jmdns-version>3.6.0</jmdns-version>
7676
<tomcat-api-version>9.0.65</tomcat-api-version>
7777
<jettison-version>1.5.4</jettison-version>
7878
<jmock-version>2.13.1</jmock-version>
@@ -97,12 +97,12 @@
9797
<shiro-version>1.13.0</shiro-version>
9898
<slf4j-version>2.0.13</slf4j-version>
9999
<snappy-version>1.1.2</snappy-version>
100-
<spring-version>6.1.14</spring-version>
100+
<spring-version>6.2.0</spring-version>
101101
<spring-version-range>[6,7)</spring-version-range>
102102
<taglibs-version>1.2.5</taglibs-version>
103103
<velocity-version>2.4.1</velocity-version>
104104
<xpp3-version>1.1.4c</xpp3-version>
105-
<xstream-version>1.4.20</xstream-version>
105+
<xstream-version>1.4.21</xstream-version>
106106
<xbean-version>4.26</xbean-version>
107107
<xerces-version>2.12.2</xerces-version>
108108
<jaxb-tools-version>4.0.8</jaxb-tools-version>

0 commit comments

Comments
 (0)