// Path: src/test/java/io/dazraf/vertx/SocketTestUtils.java
// public static int getFreePort() {
//   return getFreePort(1).get(0);
// }
// 
// Path: src/main/java/io/dazraf/vertx/futures/Futures.java
// static <T> Futures<T> when(Future<T> future) {
//   return FuturesImpl.when(future);
// }


import org.slf4j.Logger;
import java.util.function.Consumer;
import io.vertx.core.Future;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpServer;
import io.vertx.core.http.HttpServerRequest;
import static io.dazraf.vertx.SocketTestUtils.getFreePort;
import static io.dazraf.vertx.futures.Futures.when;
import static io.vertx.core.Future.future;
import static org.slf4j.LoggerFactory.getLogger;
package io.dazraf.vertx;





public class HttpServerWrapper {
  private static final String MESSAGE_OK = "OK";
  private static final Logger LOG = getLogger(HttpServerWrapper.class);

  private final int serverPort;
  private final HttpServer httpServer;

  private HttpServerWrapper(int serverPort, HttpServer httpServer) {
    this.serverPort = serverPort;
    this.httpServer = httpServer;
  }

  public static Future<HttpServerWrapper> createHttpServer(Vertx vertx) {
    return createHttpServer(vertx, request -> request.bodyHandler(buffer -> {
      request.response().end(MESSAGE_OK);
    }));
  }

  public static Future<HttpServerWrapper> createHttpServer(Vertx vertx, Consumer<HttpServerRequest> handler) {
    Future<HttpServerWrapper> httpServer = future();
// Path: src/test/java/io/dazraf/vertx/SocketTestUtils.java
// public static int getFreePort() {
//   return getFreePort(1).get(0);
// }
// 
// Path: src/main/java/io/dazraf/vertx/futures/Futures.java
// static <T> Futures<T> when(Future<T> future) {
//   return FuturesImpl.when(future);
// }


// Path: src/test/java/io/dazraf/vertx/HttpServerWrapper.java
import org.slf4j.Logger;
import java.util.function.Consumer;
import io.vertx.core.Future;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpServer;
import io.vertx.core.http.HttpServerRequest;
import static io.dazraf.vertx.SocketTestUtils.getFreePort;
import static io.dazraf.vertx.futures.Futures.when;
import static io.vertx.core.Future.future;
import static org.slf4j.LoggerFactory.getLogger;

package io.dazraf.vertx;





public class HttpServerWrapper {
  private static final String MESSAGE_OK = "OK";
  private static final Logger LOG = getLogger(HttpServerWrapper.class);

  private final int serverPort;
  private final HttpServer httpServer;

  private HttpServerWrapper(int serverPort, HttpServer httpServer) {
    this.serverPort = serverPort;
    this.httpServer = httpServer;
  }

  public static Future<HttpServerWrapper> createHttpServer(Vertx vertx) {
    return createHttpServer(vertx, request -> request.bodyHandler(buffer -> {
      request.response().end(MESSAGE_OK);
    }));
  }

  public static Future<HttpServerWrapper> createHttpServer(Vertx vertx, Consumer<HttpServerRequest> handler) {
    Future<HttpServerWrapper> httpServer = future();
    int serverPort = getFreePort();