activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject activemq git commit: AMQ-6675 AMQP Test client can't accept bigger frames on WS
Date Thu, 11 May 2017 22:37:40 GMT
Repository: activemq
Updated Branches:
  refs/heads/master 4f7c9ec81 -> 88efa01e1


AMQ-6675 AMQP Test client can't accept bigger frames on WS 

Need to configure the WS Handshaker in the test client's netty transport
with the same value given to the proton connection via setMaxFrameSize
so that incoming frames larger than the default 65535 over WS don't
trigger netty to fail the connection.

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/88efa01e
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/88efa01e
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/88efa01e

Branch: refs/heads/master
Commit: 88efa01e119197fb043a890c54ddb37abce21ff4
Parents: 4f7c9ec
Author: Timothy Bish <tabish121@gmail.com>
Authored: Thu May 11 18:33:38 2017 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Thu May 11 18:33:38 2017 -0400

----------------------------------------------------------------------
 .../transport/amqp/client/AmqpConnection.java       |  1 +
 .../amqp/client/transport/NettyTcpTransport.java    | 16 ++++++++++++++++
 .../amqp/client/transport/NettyTransport.java       |  4 ++++
 .../amqp/client/transport/NettyWSTransport.java     |  3 ++-
 .../transport/amqp/interop/AmqpConnectionsTest.java |  5 +++++
 5 files changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/88efa01e/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
index 813f9fd..1f3fe09 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
@@ -132,6 +132,7 @@ public class AmqpConnection extends AmqpAbstractResource<Connection>
implements
         this.serializer.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
 
         this.transport.setTransportListener(this);
+        this.transport.setMaxFrameSize(getMaxFrameSize());
     }
 
     public void connect() throws Exception {

http://git-wip-us.apache.org/repos/asf/activemq/blob/88efa01e/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/transport/NettyTcpTransport.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/transport/NettyTcpTransport.java
b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/transport/NettyTcpTransport.java
index eb54cda..1f5fe60 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/transport/NettyTcpTransport.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/transport/NettyTcpTransport.java
@@ -55,6 +55,7 @@ public class NettyTcpTransport implements NettyTransport {
     private static final Logger LOG = LoggerFactory.getLogger(NettyTcpTransport.class);
 
     private static final int SHUTDOWN_TIMEOUT = 100;
+    public static final int DEFAULT_MAX_FRAME_SIZE = 65535;
 
     protected Bootstrap bootstrap;
     protected EventLoopGroup group;
@@ -62,6 +63,7 @@ public class NettyTcpTransport implements NettyTransport {
     protected NettyTransportListener listener;
     protected final NettyTransportOptions options;
     protected final URI remote;
+    protected int maxFrameSize = DEFAULT_MAX_FRAME_SIZE;
 
     private final AtomicBoolean connected = new AtomicBoolean();
     private final AtomicBoolean closed = new AtomicBoolean();
@@ -265,6 +267,20 @@ public class NettyTcpTransport implements NettyTransport {
         return result;
     }
 
+    @Override
+    public void setMaxFrameSize(int maxFrameSize) {
+        if (connected.get()) {
+            throw new IllegalStateException("Cannot change Max Frame Size while connected.");
+        }
+
+        this.maxFrameSize = maxFrameSize;
+    }
+
+    @Override
+    public int getMaxFrameSize() {
+        return maxFrameSize;
+    }
+
     //----- Internal implementation details, can be overridden as needed -----//
 
     protected String getRemoteHost() {

http://git-wip-us.apache.org/repos/asf/activemq/blob/88efa01e/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/transport/NettyTransport.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/transport/NettyTransport.java
b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/transport/NettyTransport.java
index a5d0214..3896280 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/transport/NettyTransport.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/transport/NettyTransport.java
@@ -49,4 +49,8 @@ public interface NettyTransport {
 
     Principal getLocalPrincipal();
 
+    void setMaxFrameSize(int maxFrameSize);
+
+    int getMaxFrameSize();
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/88efa01e/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/transport/NettyWSTransport.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/transport/NettyWSTransport.java
b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/transport/NettyWSTransport.java
index 9693a98..f995863 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/transport/NettyWSTransport.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/transport/NettyWSTransport.java
@@ -114,7 +114,8 @@ public class NettyWSTransport extends NettyTcpTransport {
 
         public NettyWebSocketTransportHandler() {
             handshaker = WebSocketClientHandshakerFactory.newHandshaker(
-                getRemoteLocation(), WebSocketVersion.V13, AMQP_SUB_PROTOCOL, true, new DefaultHttpHeaders());
+                getRemoteLocation(), WebSocketVersion.V13, AMQP_SUB_PROTOCOL,
+                true, new DefaultHttpHeaders(), getMaxFrameSize());
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/activemq/blob/88efa01e/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpConnectionsTest.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpConnectionsTest.java
b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpConnectionsTest.java
index 6d9847d..3e24501 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpConnectionsTest.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpConnectionsTest.java
@@ -74,6 +74,11 @@ public class AmqpConnectionsTest extends AmqpClientTestSupport {
         super(connectorScheme, secure);
     }
 
+    @Override
+    protected String getAdditionalConfig() {
+        return "&wireFormat.maxAmqpFrameSize=1048576";
+    }
+
     @Test(timeout = 60000)
     public void testCanConnect() throws Exception {
         AmqpClient client = createAmqpClient();


Mime
View raw message