// Path: rsimulator-http/src/main/java/com/github/bjuvensjo/rsimulator/http/config/HttpSimulatorConfig.java
// public final class HttpSimulatorConfig {
//     private static final int READ_TIMEOUT = 12000;
//     private static final String DEFAULT_SERVER_URL = "http://localhost:8080";
//     private static final String METHOD = "GET";
// 
//     private HttpSimulatorConfig() {
//     }
// 
//     /**
//      * Configures the HttpSimulator (running on the default http://localhost:8080) with the root path of the folder of
//      * the specified testClass class folder.
//      *
//      * @param testClass the testClass
//      * @throws IOException if something goes wrong
//      */
//     public static void config(Class<?> testClass) throws IOException {
//         config(testClass, DEFAULT_SERVER_URL);
//     }
// 
//     /**
//      * Configures the HttpSimulator running on the specified serverURL (e.g. http://localhost:8080) with the root path
//      * of the folder of the specified testClass class folder.
//      *
//      * @param testClass the testClass
//      * @param serverURL the serverURL
//      * @throws IOException if something goes wrong
//      */
//     public static void config(Class<?> testClass, String serverURL) throws IOException {
//         String resource = testClass.getSimpleName() + ".class";
//         String rootPath = new File(testClass.getResource(resource).getPath()).getParentFile().getPath();
//         config(rootPath, false, serverURL);
//     }
// 
//     /**
//      * Configures the HttpSimulator (running on the default http://localhost:8080) with the specified root path and
//      * useRootRelativePath.
//      *
//      * @param rootPath            the rootPath
//      * @param useRootRelativePath the useRootRelativePath
//      * @throws IOException if something goes wrong
//      */
//     public static void config(String rootPath, boolean useRootRelativePath) throws IOException {
//         config(rootPath, useRootRelativePath, DEFAULT_SERVER_URL);
//     }
// 
//     /**
//      * Configures the HttpSimulator running on the specified serverURL (e.g. http://localhost:8080) with the specified
//      * root path and useRootRelativePath.
//      *
//      * @param rootPath            the rootPath
//      * @param useRootRelativePath the useRootRelativePath
//      * @param serverURL           the serverURL
//      * @throws IOException if something goes wrong
//      */
//     public static void config(String rootPath, boolean useRootRelativePath, String serverURL) throws IOException {
//         HttpURLConnection con = null;
//         try {
//             String urlString = serverURL + "/?" + Constants.ROOT_PATH +
//                     "=" + rootPath + "&" + Constants.USE_ROOT_RELATIVE_PATH + "=" +
//                     useRootRelativePath;
//             con = (HttpURLConnection) new URL(urlString).openConnection();
//             con.setRequestMethod(METHOD);
//             con.setReadTimeout(READ_TIMEOUT);
//             con.getResponseCode();
//         } finally {
//             con.disconnect();
//         }
//     }
// }


import com.github.bjuvensjo.rsimulator.http.config.HttpSimulatorConfig;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.file.Paths;
import static org.junit.jupiter.api.Assertions.*;
package com.github.bjuvensjo.rsimulator.http;





public class HttpSimulatorIT {
    private static final int BUFFER_SIZE = 500;
    private static final int READ_TIMEOUT = 12000;
    private static final String ENCODING = "UTF-8";
    private static final String PORT = System.getProperty("jetty.port", "25001");

    @BeforeEach
    public void init() {
        try {
            String resource = "/txt-examples";
            String rootPath = Paths.get(getClass().getResource(resource).toURI()).toString().replace(resource, "");
// Path: rsimulator-http/src/main/java/com/github/bjuvensjo/rsimulator/http/config/HttpSimulatorConfig.java
// public final class HttpSimulatorConfig {
//     private static final int READ_TIMEOUT = 12000;
//     private static final String DEFAULT_SERVER_URL = "http://localhost:8080";
//     private static final String METHOD = "GET";
// 
//     private HttpSimulatorConfig() {
//     }
// 
//     /**
//      * Configures the HttpSimulator (running on the default http://localhost:8080) with the root path of the folder of
//      * the specified testClass class folder.
//      *
//      * @param testClass the testClass
//      * @throws IOException if something goes wrong
//      */
//     public static void config(Class<?> testClass) throws IOException {
//         config(testClass, DEFAULT_SERVER_URL);
//     }
// 
//     /**
//      * Configures the HttpSimulator running on the specified serverURL (e.g. http://localhost:8080) with the root path
//      * of the folder of the specified testClass class folder.
//      *
//      * @param testClass the testClass
//      * @param serverURL the serverURL
//      * @throws IOException if something goes wrong
//      */
//     public static void config(Class<?> testClass, String serverURL) throws IOException {
//         String resource = testClass.getSimpleName() + ".class";
//         String rootPath = new File(testClass.getResource(resource).getPath()).getParentFile().getPath();
//         config(rootPath, false, serverURL);
//     }
// 
//     /**
//      * Configures the HttpSimulator (running on the default http://localhost:8080) with the specified root path and
//      * useRootRelativePath.
//      *
//      * @param rootPath            the rootPath
//      * @param useRootRelativePath the useRootRelativePath
//      * @throws IOException if something goes wrong
//      */
//     public static void config(String rootPath, boolean useRootRelativePath) throws IOException {
//         config(rootPath, useRootRelativePath, DEFAULT_SERVER_URL);
//     }
// 
//     /**
//      * Configures the HttpSimulator running on the specified serverURL (e.g. http://localhost:8080) with the specified
//      * root path and useRootRelativePath.
//      *
//      * @param rootPath            the rootPath
//      * @param useRootRelativePath the useRootRelativePath
//      * @param serverURL           the serverURL
//      * @throws IOException if something goes wrong
//      */
//     public static void config(String rootPath, boolean useRootRelativePath, String serverURL) throws IOException {
//         HttpURLConnection con = null;
//         try {
//             String urlString = serverURL + "/?" + Constants.ROOT_PATH +
//                     "=" + rootPath + "&" + Constants.USE_ROOT_RELATIVE_PATH + "=" +
//                     useRootRelativePath;
//             con = (HttpURLConnection) new URL(urlString).openConnection();
//             con.setRequestMethod(METHOD);
//             con.setReadTimeout(READ_TIMEOUT);
//             con.getResponseCode();
//         } finally {
//             con.disconnect();
//         }
//     }
// }


// Path: rsimulator-http/src/test/java/com/github/bjuvensjo/rsimulator/http/HttpSimulatorIT.java
import com.github.bjuvensjo.rsimulator.http.config.HttpSimulatorConfig;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.file.Paths;
import static org.junit.jupiter.api.Assertions.*;

package com.github.bjuvensjo.rsimulator.http;





public class HttpSimulatorIT {
    private static final int BUFFER_SIZE = 500;
    private static final int READ_TIMEOUT = 12000;
    private static final String ENCODING = "UTF-8";
    private static final String PORT = System.getProperty("jetty.port", "25001");

    @BeforeEach
    public void init() {
        try {
            String resource = "/txt-examples";
            String rootPath = Paths.get(getClass().getResource(resource).toURI()).toString().replace(resource, "");
            HttpSimulatorConfig.config(rootPath, true, "http://localhost:" + PORT);