// Path: src/outbackcdx/NanoHTTPD.java
// public enum Status implements IStatus {
//     SWITCH_PROTOCOL(101, "Switching Protocols"), OK(200, "OK"), CREATED(201, "Created"), ACCEPTED(202, "Accepted"), NO_CONTENT(204, "No Content"), PARTIAL_CONTENT(206, "Partial Content"), REDIRECT(301,
//             "Moved Permanently"), NOT_MODIFIED(304, "Not Modified"), TEMPORARY_REDIRECT(307, "Temporary Redirect"), BAD_REQUEST(400, "Bad Request"), UNAUTHORIZED(401,
//             "Unauthorized"), FORBIDDEN(403, "Forbidden"), NOT_FOUND(404, "Not Found"), METHOD_NOT_ALLOWED(405, "Method Not Allowed"), PAYLOAD_TOO_LARGE(413, "Payload Too Large"), RANGE_NOT_SATISFIABLE(416,
//             "Requested Range Not Satisfiable"), INTERNAL_ERROR(500, "Internal Server Error");
//     private final int requestStatus;
//     private final String description;
// 
//     Status(int requestStatus, String description) {
//         this.requestStatus = requestStatus;
//         this.description = description;
//     }
// 
//     @Override
//     public int getRequestStatus() {
//         return this.requestStatus;
//     }
// 
//     @Override
//     public String getDescription() {
//         return "" + this.requestStatus + " " + description;
//     }
// }
// 
// Path: src/outbackcdx/NanoHTTPD.java
// public enum Method {
//     GET, PUT, POST, DELETE, HEAD, OPTIONS;
// 
//     static Method lookup(String method) {
//         for (Method m : Method.values()) {
//             if (m.toString().equalsIgnoreCase(method)) {
//                 return m;
//             }
//         }
//         return null;
//     }
// }


import org.junit.*;
import org.junit.rules.TemporaryFolder;
import outbackcdx.NanoHTTPD.Response.Status;
import outbackcdx.auth.Permit;
import java.io.*;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.Map;
import java.util.Scanner;
import static org.junit.Assert.assertEquals;
import static outbackcdx.NanoHTTPD.Method.*;
import static outbackcdx.NanoHTTPD.Response.Status.OK;
    }

    private String POST(String url, String data, NanoHTTPD.Response.Status expectedStatus) throws Exception {
        ReplicationFeaturesTest.DummySession session = new ReplicationFeaturesTest.DummySession(POST, url);
        session.data(data);
        NanoHTTPD.Response response = webapp.handle(new Web.NRequest(session, Permit.full(), ""));
        assertEquals(expectedStatus, response.getStatus());
        return slurp(response);
    }

    private String slurp(NanoHTTPD.Response response) throws IOException {
        NanoHTTPD.IStreamer streamer = response.getStreamer();
        if (streamer != null) {
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            streamer.stream(out);
            return out.toString("UTF-8");
        }

        InputStream data = response.getData();
        if (data != null) {
            Scanner scanner = new Scanner(response.getData(), "UTF-8").useDelimiter("\\Z");
            if (scanner.hasNext()) {
                return scanner.next();
            }
        }

        return "";
    }

    private static class DummySession implements NanoHTTPD.IHTTPSession {
// Path: src/outbackcdx/NanoHTTPD.java
// public enum Status implements IStatus {
//     SWITCH_PROTOCOL(101, "Switching Protocols"), OK(200, "OK"), CREATED(201, "Created"), ACCEPTED(202, "Accepted"), NO_CONTENT(204, "No Content"), PARTIAL_CONTENT(206, "Partial Content"), REDIRECT(301,
//             "Moved Permanently"), NOT_MODIFIED(304, "Not Modified"), TEMPORARY_REDIRECT(307, "Temporary Redirect"), BAD_REQUEST(400, "Bad Request"), UNAUTHORIZED(401,
//             "Unauthorized"), FORBIDDEN(403, "Forbidden"), NOT_FOUND(404, "Not Found"), METHOD_NOT_ALLOWED(405, "Method Not Allowed"), PAYLOAD_TOO_LARGE(413, "Payload Too Large"), RANGE_NOT_SATISFIABLE(416,
//             "Requested Range Not Satisfiable"), INTERNAL_ERROR(500, "Internal Server Error");
//     private final int requestStatus;
//     private final String description;
// 
//     Status(int requestStatus, String description) {
//         this.requestStatus = requestStatus;
//         this.description = description;
//     }
// 
//     @Override
//     public int getRequestStatus() {
//         return this.requestStatus;
//     }
// 
//     @Override
//     public String getDescription() {
//         return "" + this.requestStatus + " " + description;
//     }
// }
// 
// Path: src/outbackcdx/NanoHTTPD.java
// public enum Method {
//     GET, PUT, POST, DELETE, HEAD, OPTIONS;
// 
//     static Method lookup(String method) {
//         for (Method m : Method.values()) {
//             if (m.toString().equalsIgnoreCase(method)) {
//                 return m;
//             }
//         }
//         return null;
//     }
// }


// Path: test/outbackcdx/ReplicationFeaturesTest.java
import org.junit.*;
import org.junit.rules.TemporaryFolder;
import outbackcdx.NanoHTTPD.Response.Status;
import outbackcdx.auth.Permit;
import java.io.*;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.Map;
import java.util.Scanner;
import static org.junit.Assert.assertEquals;
import static outbackcdx.NanoHTTPD.Method.*;
import static outbackcdx.NanoHTTPD.Response.Status.OK;

    }

    private String POST(String url, String data, NanoHTTPD.Response.Status expectedStatus) throws Exception {
        ReplicationFeaturesTest.DummySession session = new ReplicationFeaturesTest.DummySession(POST, url);
        session.data(data);
        NanoHTTPD.Response response = webapp.handle(new Web.NRequest(session, Permit.full(), ""));
        assertEquals(expectedStatus, response.getStatus());
        return slurp(response);
    }

    private String slurp(NanoHTTPD.Response response) throws IOException {
        NanoHTTPD.IStreamer streamer = response.getStreamer();
        if (streamer != null) {
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            streamer.stream(out);
            return out.toString("UTF-8");
        }

        InputStream data = response.getData();
        if (data != null) {
            Scanner scanner = new Scanner(response.getData(), "UTF-8").useDelimiter("\\Z");
            if (scanner.hasNext()) {
                return scanner.next();
            }
        }

        return "";
    }

    private static class DummySession implements NanoHTTPD.IHTTPSession {
        private final NanoHTTPD.Method method;