// Path: jadler-core/src/main/java/net/jadler/stubbing/server/StubHttpServer.java
// public interface StubHttpServer {
// 
//     /**
//      * Registers a response provider. This component provides a response prescription (in form
//      * of a {@link net.jadler.stubbing.StubResponse} instance) for a given http request.
//      *
//      * @param requestManager response provider to use to retrieve response prescriptions.
//      */
//     void registerRequestManager(RequestManager requestManager);
// 
// 
//     /**
//      * Starts the underlying http server. From now, the server must be able to respond
//      * according to prescriptions returned from the registered {@link StubHttpServerManager} instance.
//      *
//      * @throws Exception when ugh... something went wrong
//      */
//     void start() throws Exception;
// 
// 
//     /**
//      * Stops the underlying http server.
//      *
//      * @throws Exception when an error occurred while stopping the server
//      */
//     void stop() throws Exception;
// 
// 
//     /**
//      * @return HTTP server port
//      */
//     int getPort();
// }
// 
// Path: jadler-jdk/src/main/java/net/jadler/stubbing/server/jdk/JdkStubHttpServer.java
// public class JdkStubHttpServer implements StubHttpServer {
// 
//     private final HttpServer server;
// 
//     public JdkStubHttpServer(final int port) {
//         isTrue(port >= 0, "port cannot be a negative number");
// 
//         try {
//             server = HttpServer.create(new InetSocketAddress(port), 0);
//         } catch (final IOException e) {
//             throw new JadlerException("Cannot create JDK server", e);
//         }
//     }
// 
//     public JdkStubHttpServer() {
//         this(0);
//     }
// 
//     @Override
//     public void registerRequestManager(final RequestManager ruleProvider) {
//         notNull(ruleProvider, "ruleProvider cannot be null");
//         server.createContext("/", new JdkHandler(ruleProvider));
//     }
// 
//     @Override
//     public void start() throws Exception {
//         server.start();
//     }
// 
//     @Override
//     public void stop() throws Exception {
//         server.stop(0);
//     }
// 
//     @Override
//     public int getPort() {
//         return server.getAddress().getPort();
//     }
// }
// 
// Path: jadler-jetty/src/main/java/net/jadler/stubbing/server/jetty/JettyStubHttpServer.java
// public class JettyStubHttpServer implements StubHttpServer {
// 
//     private static final Logger logger = LoggerFactory.getLogger(JettyStubHttpServer.class);
//     private final Server server;
//     private final Connector httpConnector;
// 
//     public JettyStubHttpServer() {
//         this(0);
//     }
// 
// 
//     public JettyStubHttpServer(final int port) {
//         this.server = new Server();
//         this.server.setSendServerVersion(false);
//         this.server.setSendDateHeader(true);
// 
//         this.httpConnector = new SelectChannelConnector();
//         this.httpConnector.setPort(port);
//         server.addConnector(this.httpConnector);
//     }
// 
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public void registerRequestManager(final RequestManager ruleProvider) {
//         Validate.notNull(ruleProvider, "ruleProvider cannot be null");
// 
//         server.setHandler(new JadlerHandler(ruleProvider));
//     }
// 
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public void start() throws Exception {
//         logger.debug("starting jetty");
//         server.start();
//         logger.debug("jetty started");
//     }
// 
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public void stop() throws Exception {
//         logger.debug("stopping jetty");
//         server.stop();
//         logger.debug("jetty stopped");
//     }
// 
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public int getPort() {
//         return httpConnector.getLocalPort();
//     }
// }


import net.jadler.stubbing.server.jetty.JettyStubHttpServer;
import java.util.Arrays;
import net.jadler.stubbing.server.StubHttpServer;
import net.jadler.stubbing.server.jdk.JdkStubHttpServer;
/*
 * Copyright (c) 2012 - 2016 Jadler contributors
 * This program is made available under the terms of the MIT License.
 */
package net.jadler.parameters;



/**
 * Provides test parameters for the acceptance/integration tests located in the {@code jadler-all} module.
 */
public class TestParameters {

    /**
     * @return parameters for acceptance/integration tests located in this module. The fugly return type
     * is required by the jUnit parameters mechanism. It basically returns two stub server factories as
     * test parameters.
     */
    public Iterable<StubHttpServerFactory[]> provide() {

        return Arrays.asList(
                singletonArray(new StubHttpServerFactory() {
                    @Override
                    public StubHttpServer createServer() {
                        return new JettyStubHttpServer();
                    }
                }),
                singletonArray(new StubHttpServerFactory() {
                    @Override
                    public StubHttpServer createServer() {
// Path: jadler-core/src/main/java/net/jadler/stubbing/server/StubHttpServer.java
// public interface StubHttpServer {
// 
//     /**
//      * Registers a response provider. This component provides a response prescription (in form
//      * of a {@link net.jadler.stubbing.StubResponse} instance) for a given http request.
//      *
//      * @param requestManager response provider to use to retrieve response prescriptions.
//      */
//     void registerRequestManager(RequestManager requestManager);
// 
// 
//     /**
//      * Starts the underlying http server. From now, the server must be able to respond
//      * according to prescriptions returned from the registered {@link StubHttpServerManager} instance.
//      *
//      * @throws Exception when ugh... something went wrong
//      */
//     void start() throws Exception;
// 
// 
//     /**
//      * Stops the underlying http server.
//      *
//      * @throws Exception when an error occurred while stopping the server
//      */
//     void stop() throws Exception;
// 
// 
//     /**
//      * @return HTTP server port
//      */
//     int getPort();
// }
// 
// Path: jadler-jdk/src/main/java/net/jadler/stubbing/server/jdk/JdkStubHttpServer.java
// public class JdkStubHttpServer implements StubHttpServer {
// 
//     private final HttpServer server;
// 
//     public JdkStubHttpServer(final int port) {
//         isTrue(port >= 0, "port cannot be a negative number");
// 
//         try {
//             server = HttpServer.create(new InetSocketAddress(port), 0);
//         } catch (final IOException e) {
//             throw new JadlerException("Cannot create JDK server", e);
//         }
//     }
// 
//     public JdkStubHttpServer() {
//         this(0);
//     }
// 
//     @Override
//     public void registerRequestManager(final RequestManager ruleProvider) {
//         notNull(ruleProvider, "ruleProvider cannot be null");
//         server.createContext("/", new JdkHandler(ruleProvider));
//     }
// 
//     @Override
//     public void start() throws Exception {
//         server.start();
//     }
// 
//     @Override
//     public void stop() throws Exception {
//         server.stop(0);
//     }
// 
//     @Override
//     public int getPort() {
//         return server.getAddress().getPort();
//     }
// }
// 
// Path: jadler-jetty/src/main/java/net/jadler/stubbing/server/jetty/JettyStubHttpServer.java
// public class JettyStubHttpServer implements StubHttpServer {
// 
//     private static final Logger logger = LoggerFactory.getLogger(JettyStubHttpServer.class);
//     private final Server server;
//     private final Connector httpConnector;
// 
//     public JettyStubHttpServer() {
//         this(0);
//     }
// 
// 
//     public JettyStubHttpServer(final int port) {
//         this.server = new Server();
//         this.server.setSendServerVersion(false);
//         this.server.setSendDateHeader(true);
// 
//         this.httpConnector = new SelectChannelConnector();
//         this.httpConnector.setPort(port);
//         server.addConnector(this.httpConnector);
//     }
// 
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public void registerRequestManager(final RequestManager ruleProvider) {
//         Validate.notNull(ruleProvider, "ruleProvider cannot be null");
// 
//         server.setHandler(new JadlerHandler(ruleProvider));
//     }
// 
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public void start() throws Exception {
//         logger.debug("starting jetty");
//         server.start();
//         logger.debug("jetty started");
//     }
// 
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public void stop() throws Exception {
//         logger.debug("stopping jetty");
//         server.stop();
//         logger.debug("jetty stopped");
//     }
// 
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public int getPort() {
//         return httpConnector.getLocalPort();
//     }
// }


// Path: jadler-all/src/test/java/net/jadler/parameters/TestParameters.java
import net.jadler.stubbing.server.jetty.JettyStubHttpServer;
import java.util.Arrays;
import net.jadler.stubbing.server.StubHttpServer;
import net.jadler.stubbing.server.jdk.JdkStubHttpServer;

/*
 * Copyright (c) 2012 - 2016 Jadler contributors
 * This program is made available under the terms of the MIT License.
 */
package net.jadler.parameters;



/**
 * Provides test parameters for the acceptance/integration tests located in the {@code jadler-all} module.
 */
public class TestParameters {

    /**
     * @return parameters for acceptance/integration tests located in this module. The fugly return type
     * is required by the jUnit parameters mechanism. It basically returns two stub server factories as
     * test parameters.
     */
    public Iterable<StubHttpServerFactory[]> provide() {

        return Arrays.asList(
                singletonArray(new StubHttpServerFactory() {
                    @Override
                    public StubHttpServer createServer() {
                        return new JettyStubHttpServer();
                    }
                }),
                singletonArray(new StubHttpServerFactory() {
                    @Override
                    public StubHttpServer createServer() {
                        return new JdkStubHttpServer();