package twopm.tech.bench.jaxrs;

import com.sun.net.httpserver.HttpServer;
import java.io.IOException;
import java.net.InetSocketAddress;
import org.jboss.resteasy.plugins.server.sun.http.HttpContextBuilder;

public class Bench {

	public static void main(String[] args) throws IOException, InterruptedException {
		HttpServer server = HttpServer.create(new InetSocketAddress(8080), 10);
		HttpContextBuilder contextBuilder = new HttpContextBuilder();
		contextBuilder.getDeployment().getActualResourceClasses().add(TestResource.class);
		server.start();

		Runtime.getRuntime().addShutdownHook(new Thread(() -> {
			contextBuilder.cleanup();
			server.stop(0);
		}));
	}
}
