From c27e27c2c30f6d728d8dc1e6b8ea7c5c8a02c1b0 Mon Sep 17 00:00:00 2001 From: jbonofre Date: Wed, 13 Jan 2021 11:41:17 +0100 Subject: [PATCH] [AMQ-7444] Fallback to remote location for remote address when socket has not been created yet (cherry picked from commit 0c1b3e9240dbda0aee0426bfcef5e9cc628af7c7) --- .../transport/stomp/StompNIOSSLTransport.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/StompNIOSSLTransport.java b/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/StompNIOSSLTransport.java index cb199aec40..d2e394b86e 100644 --- a/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/StompNIOSSLTransport.java +++ b/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/StompNIOSSLTransport.java @@ -49,13 +49,20 @@ public class StompNIOSSLTransport extends NIOSSLTransport { super(wireFormat, socket, null, null, null); } - - public StompNIOSSLTransport(WireFormat wireFormat, Socket socket, SSLEngine engine, InitBuffer initBuffer, ByteBuffer inputBuffer) throws IOException { super(wireFormat, socket, engine, initBuffer, inputBuffer); } + @Override + public String getRemoteAddress() { + String remoteAddress = super.getRemoteAddress(); + if (remoteAddress == null) { + return remoteLocation.toString(); + } + return remoteAddress; + } + @Override protected void initializeStreams() throws IOException { codec = new StompCodec(this);