// Path: src/main/java/info/jdavid/ok/server/header/Connection.java
// @SuppressWarnings({ "WeakerAccess", "unused" })
// public final class Connection {
// 
//   private Connection() {}
// 
//   public static final String HEADER = "Connection";
// 
//   public static final String CLOSE = "Close";
//   public static final String KEEP_ALIVE = "Keep-Alive";
// 
// }
// 
// Path: src/main/java/info/jdavid/ok/server/header/Expect.java
// @SuppressWarnings({ "WeakerAccess" })
// public final class Expect {
// 
//   private Expect() {}
// 
//   public static final String HEADER = "Expect";
// 
//   public static final String CONTINUE = "100-Continue";
// 
// }


import java.io.IOException;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.nio.charset.Charset;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import info.jdavid.ok.server.header.Connection;
import info.jdavid.ok.server.header.Expect;
import okhttp3.Headers;
import okhttp3.internal.http.HttpMethod;
import okio.Buffer;
import okio.BufferedSink;
import okio.BufferedSource;
import okio.ByteString;
import okio.Okio;
  }

  private static boolean useSocket(final BufferedSource in, final int reuse,
                                   final KeepAliveStrategy strategy) {
    final int timeout = strategy.timeout(reuse);
    if (timeout <= 0) {
      return reuse == 0;
    }
    else {
      in.timeout().timeout(timeout, TimeUnit.SECONDS);
      return true;
    }
  }

  static void serve(final Socket socket, final boolean secure, final boolean insecureOnly,
                    final long maxRequestSize,
                    final KeepAliveStrategy keepAliveStrategy,
                    final RequestHandler requestHandler) throws IOException {
    final BufferedSource in = Okio.buffer(Okio.source(socket));
    final BufferedSink out = Okio.buffer(Okio.sink(socket));
    try {
      final String clientIp = socket.getInetAddress().getHostAddress();
      int reuseCounter = 0;
      while (useSocket(in, reuseCounter++, keepAliveStrategy)) {
        long availableRequestSize = maxRequestSize;
        final ByteString requestByteString = readRequestLine(in);
        final Response response;
        if (requestByteString == null || requestByteString.size() < 3) {
          response = new Response.Builder().
            statusLine(StatusLines.BAD_REQUEST).
// Path: src/main/java/info/jdavid/ok/server/header/Connection.java
// @SuppressWarnings({ "WeakerAccess", "unused" })
// public final class Connection {
// 
//   private Connection() {}
// 
//   public static final String HEADER = "Connection";
// 
//   public static final String CLOSE = "Close";
//   public static final String KEEP_ALIVE = "Keep-Alive";
// 
// }
// 
// Path: src/main/java/info/jdavid/ok/server/header/Expect.java
// @SuppressWarnings({ "WeakerAccess" })
// public final class Expect {
// 
//   private Expect() {}
// 
//   public static final String HEADER = "Expect";
// 
//   public static final String CONTINUE = "100-Continue";
// 
// }


// Path: src/main/java/info/jdavid/ok/server/Http11.java
import java.io.IOException;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.nio.charset.Charset;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import info.jdavid.ok.server.header.Connection;
import info.jdavid.ok.server.header.Expect;
import okhttp3.Headers;
import okhttp3.internal.http.HttpMethod;
import okio.Buffer;
import okio.BufferedSink;
import okio.BufferedSource;
import okio.ByteString;
import okio.Okio;

  }

  private static boolean useSocket(final BufferedSource in, final int reuse,
                                   final KeepAliveStrategy strategy) {
    final int timeout = strategy.timeout(reuse);
    if (timeout <= 0) {
      return reuse == 0;
    }
    else {
      in.timeout().timeout(timeout, TimeUnit.SECONDS);
      return true;
    }
  }

  static void serve(final Socket socket, final boolean secure, final boolean insecureOnly,
                    final long maxRequestSize,
                    final KeepAliveStrategy keepAliveStrategy,
                    final RequestHandler requestHandler) throws IOException {
    final BufferedSource in = Okio.buffer(Okio.source(socket));
    final BufferedSink out = Okio.buffer(Okio.sink(socket));
    try {
      final String clientIp = socket.getInetAddress().getHostAddress();
      int reuseCounter = 0;
      while (useSocket(in, reuseCounter++, keepAliveStrategy)) {
        long availableRequestSize = maxRequestSize;
        final ByteString requestByteString = readRequestLine(in);
        final Response response;
        if (requestByteString == null || requestByteString.size() < 3) {
          response = new Response.Builder().
            statusLine(StatusLines.BAD_REQUEST).
            header(Connection.HEADER, Connection.CLOSE).