Testing HTTP/2 communication requires a server and client communicating over TCP connections.

While looking for a way to implement automated tests for the HTTP/2 client h2c, I came across Arquillian Cube, which is an Arquillian extension that can be used to manage Docker containers from Arquillian.

I created some initial tests in the arquillian-tests folder in the h2c GitHub repository. The test can be run with maven:

mvn clean package


This blog shows how to implement automated tests of HTTP/2 communication with Arquillian Cube.

Running the tests in the arquillian-tests directory will:

Arquillian Cube provides a convenient way to test HTTP/2 services through real TCP connections without using mocks.

How to Use Docker with Arquillian

First of all, the arquillian-cube-docker dependency need to be added to pom.xml (in addition to the usual arquillian dependencies):


Secondly, the maven-surefire-plugin must be configured to launch the wildfly-docker container:

            <!-- The wildfly-docker container is defined in src/test/resources/arquillian.xml -->

The container itself is configured in arquillian.xml in src/test/resources:

<?xml version="1.0"?>
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    <extension qualifier="docker">

        <!-- REMOVE THE serverUri IF RUNNING ON LINUX -->
        <property name="serverUri">https://dockerHost:2376</property>

        <property name="dockerContainers">
                image: fstab/wildfly-http2:9.0.1.Final
                    strategy: polling
                    sleepPollingTime: 1000
                    iterations: 120
                portBindings: ["8443", "9990"]

    <!-- The container configuration uses the magic string dockerServerIp -->
    <!-- to point to the boot2docker ip (Windows, OS X) or to localhost (Linux). -->
    <container qualifier="wildfly-docker" default="true">
            <property name="managementAddress">dockerServerIp</property>
            <property name="managementPort">9990</property>
            <property name="username">admin</property>
            <property name="password">admin</property>
Update: The arquillian.xml in the original post contained a static wait strategy with a statically configured boot2docker host. I simplified this after Alex Soto's comment. Thanks Alex.

The configuration above assumes boot2docker listening on port 2376. In order to run it on native Linux, remove the property serverUri in arquillian.xml.