activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-1160 AMQP test client should configure netty WS maxFrameSize
Date Mon, 15 May 2017 13:02:35 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master ac97d6f05 -> 47e0cffc9


ARTEMIS-1160 AMQP test client should configure netty WS maxFrameSize

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-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/e872f152
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/e872f152
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/e872f152

Branch: refs/heads/master
Commit: e872f1524abe5738d96feff3a53bd9d25f0151f8
Parents: ac97d6f
Author: Timothy Bish <tabish121@gmail.com>
Authored: Thu May 11 18:50:36 2017 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Fri May 12 14:48:23 2017 -0400

----------------------------------------------------------------------
 .../transport/amqp/client/AmqpConnection.java       |  5 ++---
 .../amqp/client/transport/NettyTcpTransport.java    | 16 ++++++++++++++++
 .../amqp/client/transport/NettyTransport.java       |  4 ++++
 .../amqp/client/transport/NettyWSTransport.java     |  5 +++--
 4 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e872f152/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
----------------------------------------------------------------------
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
index 062729c..a6959ac 100644
--- a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
@@ -109,9 +109,7 @@ public class AmqpConnection extends AmqpAbstractResource<Connection>
implements
    private boolean trace;
    private boolean noContainerID = false;
 
-   public AmqpConnection(org.apache.activemq.transport.amqp.client.transport.NettyTransport
transport,
-                         String username,
-                         String password) {
+   public AmqpConnection(org.apache.activemq.transport.amqp.client.transport.NettyTransport
transport, String username, String password) {
       setEndpoint(Connection.Factory.create());
       getEndpoint().collect(protonCollector);
 
@@ -137,6 +135,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-artemis/blob/e872f152/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/transport/NettyTcpTransport.java
----------------------------------------------------------------------
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/transport/NettyTcpTransport.java
b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/transport/NettyTcpTransport.java
index 473fd75..247dd84 100644
--- a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/transport/NettyTcpTransport.java
+++ b/tests/artemis-test-support/src/main/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-artemis/blob/e872f152/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/transport/NettyTransport.java
----------------------------------------------------------------------
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/transport/NettyTransport.java
b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/transport/NettyTransport.java
index ad0a1fb..4d5a389 100644
--- a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/transport/NettyTransport.java
+++ b/tests/artemis-test-support/src/main/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-artemis/blob/e872f152/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/transport/NettyWSTransport.java
----------------------------------------------------------------------
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/transport/NettyWSTransport.java
b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/transport/NettyWSTransport.java
index eb595d0..b96fc71 100644
--- a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/transport/NettyWSTransport.java
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/transport/NettyWSTransport.java
@@ -113,8 +113,9 @@ public class NettyWSTransport extends NettyTcpTransport {
       private final WebSocketClientHandshaker handshaker;
 
       NettyWebSocketTransportHandler() {
-         handshaker = WebSocketClientHandshakerFactory.newHandshaker(getRemoteLocation(),
WebSocketVersion.V13, AMQP_SUB_PROTOCOL, true,
-            new DefaultHttpHeaders());
+         handshaker = WebSocketClientHandshakerFactory.newHandshaker(
+            getRemoteLocation(), WebSocketVersion.V13, AMQP_SUB_PROTOCOL,
+            true, new DefaultHttpHeaders(), getMaxFrameSize());
       }
 
       @Override


Mime
View raw message