// Path: jadler-all/src/test/java/net/jadler/parameters/TestParameters.java
// 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();
//                     }
//                 })
//         );
//     }
// 
//     private StubHttpServerFactory[] singletonArray(final StubHttpServerFactory server) {
//         return new StubHttpServerFactory[]{server};
//     }
// }
// 
// Path: jadler-core/src/main/java/net/jadler/Jadler.java
// public static void closeJadler() {
//     final StubHttpServerManager serverManager = jadlerMockerContainer.get();
//     if (serverManager != null && serverManager.isStarted()) {
//         serverManager.close();
//     }
// 
//     jadlerMockerContainer.set(null);
// }
// 
// Path: jadler-core/src/main/java/net/jadler/Jadler.java
// public static OngoingConfiguration initJadlerUsing(final StubHttpServer server) {
//     return initInternal(new JadlerMocker(server));
// }
// 
// Path: jadler-core/src/main/java/net/jadler/Jadler.java
// public static RequestStubbing onRequest() {
//     checkInitialized();
//     return jadlerMockerContainer.get().onRequest();
// }
// 
// Path: jadler-all/src/test/java/net/jadler/utils/TestUtils.java
// public static final StatusRetriever STATUS_RETRIEVER = new StatusRetriever();
// 
// Path: jadler-all/src/test/java/net/jadler/utils/TestUtils.java
// public static String jadlerUri() {
//     return "http://localhost:" + port();
// }


import net.jadler.parameters.StubHttpServerFactory;
import net.jadler.parameters.TestParameters;
import org.apache.http.client.fluent.Executor;
import org.apache.http.client.fluent.Request;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.io.IOException;
import static net.jadler.Jadler.closeJadler;
import static net.jadler.Jadler.initJadlerUsing;
import static net.jadler.Jadler.onRequest;
import static net.jadler.utils.TestUtils.STATUS_RETRIEVER;
import static net.jadler.utils.TestUtils.jadlerUri;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
/*
 * Copyright (c) 2012 - 2016 Jadler contributors
 * This program is made available under the terms of the MIT License.
 */
package net.jadler;





/**
 * When a timeout value is defined in a jUnit test, the test is executed in a different thread than the thread
 * executing the setup and teardown methods thus a separated test for it.
 */
@RunWith(Parameterized.class)
public class TimeoutIntegrationTest {

    private final StubHttpServerFactory serverFactory;


    public TimeoutIntegrationTest(final StubHttpServerFactory serverFactory) {
        this.serverFactory = serverFactory;
    }

    @Parameterized.Parameters
    public static Iterable<StubHttpServerFactory[]> parameters() {
        return new TestParameters().provide();
    }

    @AfterClass
    public static void cleanup() {
        Executor.closeIdleConnections();
    }

    @Before
    public void setUp() {
        initJadlerUsing(this.serverFactory.createServer());
    }

    @After
    public void tearDown() {
// Path: jadler-all/src/test/java/net/jadler/parameters/TestParameters.java
// 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();
//                     }
//                 })
//         );
//     }
// 
//     private StubHttpServerFactory[] singletonArray(final StubHttpServerFactory server) {
//         return new StubHttpServerFactory[]{server};
//     }
// }
// 
// Path: jadler-core/src/main/java/net/jadler/Jadler.java
// public static void closeJadler() {
//     final StubHttpServerManager serverManager = jadlerMockerContainer.get();
//     if (serverManager != null && serverManager.isStarted()) {
//         serverManager.close();
//     }
// 
//     jadlerMockerContainer.set(null);
// }
// 
// Path: jadler-core/src/main/java/net/jadler/Jadler.java
// public static OngoingConfiguration initJadlerUsing(final StubHttpServer server) {
//     return initInternal(new JadlerMocker(server));
// }
// 
// Path: jadler-core/src/main/java/net/jadler/Jadler.java
// public static RequestStubbing onRequest() {
//     checkInitialized();
//     return jadlerMockerContainer.get().onRequest();
// }
// 
// Path: jadler-all/src/test/java/net/jadler/utils/TestUtils.java
// public static final StatusRetriever STATUS_RETRIEVER = new StatusRetriever();
// 
// Path: jadler-all/src/test/java/net/jadler/utils/TestUtils.java
// public static String jadlerUri() {
//     return "http://localhost:" + port();
// }


// Path: jadler-all/src/test/java/net/jadler/TimeoutIntegrationTest.java
import net.jadler.parameters.StubHttpServerFactory;
import net.jadler.parameters.TestParameters;
import org.apache.http.client.fluent.Executor;
import org.apache.http.client.fluent.Request;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.io.IOException;
import static net.jadler.Jadler.closeJadler;
import static net.jadler.Jadler.initJadlerUsing;
import static net.jadler.Jadler.onRequest;
import static net.jadler.utils.TestUtils.STATUS_RETRIEVER;
import static net.jadler.utils.TestUtils.jadlerUri;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

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





/**
 * When a timeout value is defined in a jUnit test, the test is executed in a different thread than the thread
 * executing the setup and teardown methods thus a separated test for it.
 */
@RunWith(Parameterized.class)
public class TimeoutIntegrationTest {

    private final StubHttpServerFactory serverFactory;


    public TimeoutIntegrationTest(final StubHttpServerFactory serverFactory) {
        this.serverFactory = serverFactory;
    }

    @Parameterized.Parameters
    public static Iterable<StubHttpServerFactory[]> parameters() {
        return new TestParameters().provide();
    }

    @AfterClass
    public static void cleanup() {
        Executor.closeIdleConnections();
    }

    @Before
    public void setUp() {
        initJadlerUsing(this.serverFactory.createServer());
    }

    @After
    public void tearDown() {
        closeJadler();