-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Express.listen() spawns a separate thread to instantiate and start underlying HttpServer.
This introduces a race condition if an automated test is trying to execute an http call to the express app right after call to listen().
Workaround:
public void start(int port) {
System.out.println("Application starting...");
CountDownLatch latch = new CountDownLatch(1);
express = new Express();
//configuration of routes omitted
express.listen(latch::countDown, port);
latch.await();
System.out.println("Application started @ http://localhost:" + getPort());
}
I'd prefer not to have to use CountDownLatch.
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested