jbertram commented on code in PR #4712:
URL: https://github.com/apache/activemq-artemis/pull/4712#discussion_r1427266317


##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/NettyConnectorTest.java:
##########
@@ -60,4 +64,32 @@ public void testConnectionTimeoutConfig() throws Exception {
       factory.close();
       locator.close();
    }
+
+   @Test
+   public void testConnectionHttpHeaders() throws Exception {
+      TransportConfiguration transport = new 
TransportConfiguration(NETTY_CONNECTOR_FACTORY);
+      transport.getParams().put(TransportConstants.HTTP_ENABLED_PROP_NAME, 
true);
+      transport.getParams().put("netty.http.header.accept", 
"text/html,application/xhtml+xml,application/xml");
+      transport.getParams().put("netty.http.header.Accept-Encoding", 
"gzip,deflate");
+      transport.getParams().put("netty.http.header.Accept-Language", 
"en-us,en;q=0.5");
+
+      try (ServerLocator locator = 
ActiveMQClient.createServerLocatorWithoutHA(transport)) {
+         ClientSessionFactoryImpl factory = (ClientSessionFactoryImpl) 
locator.createSessionFactory();
+         NettyConnector connector = (NettyConnector) factory.getConnector();
+
+         Bootstrap bootstrap = connector.getBootStrap();
+         ChannelPipeline pipeline = bootstrap.register().channel().pipeline();
+         pipeline.flush();
+         Object httpHandler = pipeline.get("NettyConnector$HttpHandler#0");
+         Method getHeadersMethod = 
httpHandler.getClass().getMethod("getHeaders", null);
+         getHeadersMethod.setAccessible(true);
+         Map<String, String> headers = (Map<String, String>) 
getHeadersMethod.invoke(httpHandler, null);
+         assertEquals(3, headers.size());
+         assertTrue(headers.containsKey("accept"));

Review Comment:
   I think it would be worth confirming the _value_ of the headers along with 
their presence.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to