// Path: falchion-jetty9-connector/src/main/java/net/unit8/falchion/jetty9/ReusePortConnector.java
// public class ReusePortConnector extends ServerConnector {
//     public ReusePortConnector(@Name("server") Server server) {
//         super(server);
//     }
// 
//     public ReusePortConnector(@Name("server") Server server, @Name("factories") ConnectionFactory... factories) {
//         super(server, factories);
//     }
// 
//     @Override
//     public void open() throws IOException {
//         ServerSocketChannel serverChannel = ServerSocketChannel.open();
//         serverChannel.setOption(StandardSocketOptions.SO_REUSEPORT, true);
// 
//         InetSocketAddress bindAddress = getHost() == null ? new InetSocketAddress(getPort()) : new InetSocketAddress(getHost(), getPort());
//         serverChannel.socket().setReuseAddress(getReuseAddress());
//         serverChannel.socket().bind(bindAddress, getAcceptQueueSize());
//         serverChannel.configureBlocking(true);
//         addBean(serverChannel);
//         try {
//             Field acceptChannel = ServerConnector.class.getDeclaredField("_acceptChannel");
//             acceptChannel.setAccessible(true);
//             acceptChannel.set(this, serverChannel);
//         } catch (Exception ex) {
//             throw new IOException(ex);
//         }
//     }
// }


import com.codahale.metrics.jmx.JmxReporter;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.jetty9.InstrumentedHandler;
import net.unit8.falchion.jetty9.ReusePortConnector;
import okhttp3.Call;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.RequestBody;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.management.ManagementFactory;
import java.util.Random;
import java.util.UUID;
package net.unit8.falchion.example.jetty9;



/**
 * @author kawasima
 */
public class Main {
    public static void main(String[] args) throws Exception {
        MetricRegistry metrics = new MetricRegistry();
        String serverId = UUID.randomUUID().toString();
        Server server = new Server();
// Path: falchion-jetty9-connector/src/main/java/net/unit8/falchion/jetty9/ReusePortConnector.java
// public class ReusePortConnector extends ServerConnector {
//     public ReusePortConnector(@Name("server") Server server) {
//         super(server);
//     }
// 
//     public ReusePortConnector(@Name("server") Server server, @Name("factories") ConnectionFactory... factories) {
//         super(server, factories);
//     }
// 
//     @Override
//     public void open() throws IOException {
//         ServerSocketChannel serverChannel = ServerSocketChannel.open();
//         serverChannel.setOption(StandardSocketOptions.SO_REUSEPORT, true);
// 
//         InetSocketAddress bindAddress = getHost() == null ? new InetSocketAddress(getPort()) : new InetSocketAddress(getHost(), getPort());
//         serverChannel.socket().setReuseAddress(getReuseAddress());
//         serverChannel.socket().bind(bindAddress, getAcceptQueueSize());
//         serverChannel.configureBlocking(true);
//         addBean(serverChannel);
//         try {
//             Field acceptChannel = ServerConnector.class.getDeclaredField("_acceptChannel");
//             acceptChannel.setAccessible(true);
//             acceptChannel.set(this, serverChannel);
//         } catch (Exception ex) {
//             throw new IOException(ex);
//         }
//     }
// }


// Path: falchion-example-jetty9/src/main/java/net/unit8/falchion/example/jetty9/Main.java
import com.codahale.metrics.jmx.JmxReporter;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.jetty9.InstrumentedHandler;
import net.unit8.falchion.jetty9.ReusePortConnector;
import okhttp3.Call;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.RequestBody;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.management.ManagementFactory;
import java.util.Random;
import java.util.UUID;

package net.unit8.falchion.example.jetty9;



/**
 * @author kawasima
 */
public class Main {
    public static void main(String[] args) throws Exception {
        MetricRegistry metrics = new MetricRegistry();
        String serverId = UUID.randomUUID().toString();
        Server server = new Server();
        ReusePortConnector connector = new ReusePortConnector(server);