package Principal;
import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;

import Client.Client;
public class Main {
	public static void main(String[] args) {
		try{	 
			String port = "8443";
			String url = "//ens/home01/m/matias.videla/Documents/";
			
			Config c = Config.getInstance();
			c.setPort(port);
			c.setUrl(url);
			
			// The Jetty Server.
		  Server server = new Server();
		  
		  // Common HTTP configuration.
		  HttpConfiguration config = new HttpConfiguration();
		 
		  // HTTP/1.1 support.   
		  //HttpConnectionFactory http1 = new HttpConnectionFactory(config);
		  
		  // HTTP/2 cleartext support.
		  HTTP2CServerConnectionFactory http2c = new HTTP2CServerConnectionFactory(config);
		  
		  ServerConnector connector = new ServerConnector(server, http2c);
		  connector.setPort(Integer.parseInt(port));
		  server.addConnector(connector);
		  
		  ServletContextHandler handler = new ServletContextHandler(server, "/redes");
		
		  handler.addServlet(MyServlet.class, "/");
		  server.start();	
		  Client thread1 = new Client();
			Thread t1 = new Thread(thread1);
			t1.start();
					  
		}catch(Exception ex){
			System.out.println("Ocurrio una excepcion..." + ex.getMessage());
		}
	}
}
