package twopm.tech.bench.jaxrs;

import io.netty.channel.Channel;
import java.io.IOException;
import java.net.URI;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.glassfish.jersey.netty.httpserver.NettyHttpContainerProvider;
import org.glassfish.jersey.server.ResourceConfig;

public class Bench {

	public static final String BASE_URI = "http://0.0.0.0:8080/";

	public static void main(String[] args) throws IOException, Exception {
		final ResourceConfig rc = new ResourceConfig().packages("twopm.tech.bench.jaxrs");
		final Channel server = NettyHttpContainerProvider.createServer(URI.create(BASE_URI), rc, false);
		Runtime.getRuntime().addShutdownHook(new Thread(() -> {
			try {
				server.close();
			} catch (Exception ex) {
				Logger.getLogger(Bench.class.getName()).log(Level.SEVERE, null, ex);
			}
		}));
	}

}
