multithreading - Why Unit test of WebServer project shows strange behaviour? -


i writing unit test of project http threadpooled web server. using junit in maven.

in mean while stuck in 1 place, , doubt follows,

  1. there 1 class named webserver, task start server, makes threadpool, , starts listening on port client request. when make thread same, in test class under annotation @beforeclass, expected wait client request , comes out shows test completes.

    public class webservertest {

    @beforeclass public static void webserverstarter() {     system.out.println("before class : webserverstarter");     new thread(new webserver()).start(); }  @afterclass public static void webservercleanup() {     system.out.println("after class : webserverstarter"); } 

    }

i don't understand why not waits client request. please me in writing unit test testing http threadpooled webserver.

the @before executed before every single test. if want use 1 single webserver, make object!


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -