Arquillian Container Undertow 1.0.0.Alpha1 Released

Since we wrote this post we didn't laze around. Check our latest announcement.

The Arquillian team is proud to announce the 1.0.0.Alpha1 release of the Arquillian Container Undertow component!

Aliens are conquering Undertow.

Undertow is a flexible performant web server written in java, providing both a blocking and a non-blocking API’s based on NIO.

This extension enables us to write Arquillian tests for Undertow.

To simplify the development of tests on Undertow we have created two Shrinkwrap extensions:

  • Embedded Servlet Deployment
  • Non-blocking handler

Embedded Servlet Deployment

When you want to deploy a servlet(s) inside Undertow, you need to create a DeploymentInfo class and provide all the required information. For this, Arquillian-Container-Undertow provide a Shrinkwrap extension named UndertowWebArchive.
@Deployment(testable = false)
public static Archive<WebArchive> createDeployment() {
	return ShrinkWrap.create(UndertowWebArchive.class).from(
					servlet("MessageServlet", MessageServlet.class)
						.addInitParam("message", "Hello World")

public void shouldBeAbleToInvokeServletInDeployedWebApp(
		@ArquillianResource URL url) throws Exception {

	String body = readAllAndClose(new URL(url, "myservlet").openStream());
	assertThat(body, is("Hello World"));

We are creating the deployment using the Fluent-API provided by Undertow.

Non-blocking handler

With Undertow you can also write non-blocking handlers. For creating a non-blocking handler in Undertow you create a class that implements the HttpHandler interface and register it. For this, Arquillian-Container-Undertow provide a Shrinkwrap extension named UndertowHttpHandlerArchive.
@Deployment(testable = false)
public static Archive<JavaArchive> createDeployment() {
	return ShrinkWrap.create(UndertowHttpHandlerArchive.class).from(new HttpHandler() {
           public void handleRequest(final HttpServerExchange exchange) throws Exception {
               exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");
               exchange.getResponseSender().send("Hello World");

public void shouldBeAbleToInvokeHandlers(@ArquillianResource URL url) throws Exception {

	String body = readAllAndClose(url.openStream());

	assertThat(body, is("Hello World"));

We are using the HttpHandler interface provided by Undertow.


You can configure the bind address and port of Undertow. By default Undertow is started on localhost:8080.

<container qualifier="undertow" default="true">
		<property name="bindAddress">localhost</property>
		<property name="bindHttpPort">9090</property> 

If the bindHttpPort is set to -1, a random port between 1024 and 49151 is used.

What is Arquillian?

Arquillian is open source software that empowers you to test JVM-based applications more effectively. Created to defend the software galaxy from bugs, Arquillian brings your test to the runtime so you can focus on testing your application's behavior rather than managing the runtime. Using Arquillian, you can develop a comprehensive suite of tests from the convenience of your IDE and run them in any IDE, build tool or continuous integration environment.

Release details

Component Arquillian Container Undertow
Version 1.0.0.Alpha1 view tag
Release date 2014-02-13
Released by Aslak Knutsen
Compiled against

Published artifacts org.jboss.arquillian.container

  • org.jboss.arquillian.container » shrinkwrap-container-undertow jar javadoc pom
  • org.jboss.arquillian.container » undertow-embedded jar javadoc pom

Thanks to the following list of contributors: Alex Soto, Aslak Knutsen