@Test
public void preflightCheck() throws URISyntaxException, IOException {

    HttpExchange exchange = prepareExchange("http://localhost:8080/",
                                            "Origin","http://localhost:8080/",
                                            "Access-Control-Request-Headers","X-Bla, X-Blub");
    expect(exchange.getRequestMethod()).andReturn("OPTIONS");
    Headers header = new Headers();
    ByteArrayOutputStream out = prepareResponse(handler, exchange, header);
    handler.doHandle(exchange);
    assertEquals(header.getFirst("Access-Control-Allow-Origin"),"http://localhost:8080/");
    assertEquals(header.getFirst("Access-Control-Allow-Headers"),"X-Bla, X-Blub");
    assertNotNull(header.getFirst("Access-Control-Max-Age"));
}