Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Logger logger = LogManager.GetLogger("console");
            logger.Info("Starting default oswos.net server...");

            var repository = new WebsiteRepository();

            var endpointHost = new WebsiteEndpointServer(repository);
            endpointHost.Start();

            var server = new PortListener(new HttpSocketConnectionFactory(new HttpStreamRouter(repository)));
            server.Start(DefaultPort);

            logger.Info("Listening at port {0}", DefaultPort);
            logger.Info("Open a browser and connect to http://localhost:{0}", DefaultPort);

            logger.Info("Close window to shutdown");

            while (true)
            {
                Thread.Sleep(10000); // You should make a connection attempt in 10 seconds.
            }

            // Console readline has a bug
            //System.Console.ReadLine();

            //endpointHost.Stop();
            //server.Stop();
        }
Ejemplo n.º 2
0
 public IWebsiteAdapter CreateWebsiteEndpoint(string host)
 {
     var website = new WebsiteRepository().GetByHost(host);
     if (website == null)
     {
         throw new WebsiteNotFoundException(host);
     }
     return FactoryCache[website.HostName].CreateChannel();
 }