package hello;

import com.google.common.net.MediaType;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.Headers;
import java.nio.ByteBuffer;

import static hello.HelloWebServer.TEXT_PLAIN;

/**
 * Handles the plaintext test.
 */
final class PlaintextHandler implements HttpHandler {
  private static final ByteBuffer buffer;
  private static final String MESSAGE = "Hello, World!";

  static {
      buffer = ByteBuffer.allocateDirect(MESSAGE.length());   
      try {
          buffer.put(MESSAGE.getBytes("US-ASCII"));
      } catch (Exception e) {
          throw new RuntimeException(e);
      }
      buffer.flip();
  }
     
  @Override
  public void handleRequest(HttpServerExchange exchange) throws Exception {
    exchange.getResponseHeaders().put(
        Headers.CONTENT_TYPE, TEXT_PLAIN);
    exchange.getResponseSender().send(buffer.duplicate());
  }
}

package hello;

import com.google.common.net.MediaType;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.Headers;

import static hello.HelloWebServer.TEXT_PLAIN;

/**
 * Handles the plaintext test.
 */
final class PlaintextHandler implements HttpHandler {
  @Override
  public void handleRequest(HttpServerExchange exchange) throws Exception {
    exchange.getResponseHeaders().put(
        Headers.CONTENT_TYPE, TEXT_PLAIN);
    exchange.getResponseSender().send("Hello, World!");
  }
}

--- 
+++ 
@@ -4,6 +4,7 @@
 import io.undertow.server.HttpHandler;
 import io.undertow.server.HttpServerExchange;
 import io.undertow.util.Headers;
+import java.nio.ByteBuffer;
 
 import static hello.HelloWebServer.TEXT_PLAIN;
 
@@ -11,10 +12,23 @@
  * Handles the plaintext test.
  */
 final class PlaintextHandler implements HttpHandler {
+  private static final ByteBuffer buffer;
+  private static final String MESSAGE = "Hello, World!";
+
+  static {
+      buffer = ByteBuffer.allocateDirect(MESSAGE.length());   
+      try {
+          buffer.put(MESSAGE.getBytes("US-ASCII"));
+      } catch (Exception e) {
+          throw new RuntimeException(e);
+      }
+      buffer.flip();
+  }
+     
   @Override
   public void handleRequest(HttpServerExchange exchange) throws Exception {
     exchange.getResponseHeaders().put(
         Headers.CONTENT_TYPE, TEXT_PLAIN);
-    exchange.getResponseSender().send("Hello, World!");
+    exchange.getResponseSender().send(buffer.duplicate());
   }
 }
Make test apples to apples with other framework tests that have started caching the response buffer
