private void OnExecute()
 {
     p2pServer.Listen();
     p2pServer.CoonnectToPeers();
     Console.ReadLine();
     p2pServer.StopServer();
 }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, P2PServer p2PServer)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseAuthentication();

            app.UseMvc();

            string peersCSV = Configuration["Peers"];

            p2PServer.PopulatePeers(peersCSV);
            p2PServer.Listen();
        }