Fix the test run.
This commit is contained in:
		
							parent
							
								
									4d0c5f5c18
								
							
						
					
					
						commit
						251baca8e2
					
				
					 3 changed files with 14 additions and 6 deletions
				
			
		|  | @ -27,7 +27,8 @@ import java.net.InetSocketAddress; | |||
| import java.net.URISyntaxException; | ||||
| import java.nio.charset.StandardCharsets; | ||||
| import java.util.concurrent.ExecutorService; | ||||
| import java.util.concurrent.Executors; | ||||
| import java.util.concurrent.SynchronousQueue; | ||||
| import java.util.concurrent.ThreadPoolExecutor; | ||||
| import java.util.concurrent.TimeUnit; | ||||
| import java.util.concurrent.atomic.AtomicBoolean; | ||||
| import java.util.function.Function; | ||||
|  | @ -37,7 +38,13 @@ public class LabyrinthServer { | |||
|     @NonNull | ||||
|     private final HttpServer httpServer; | ||||
|     @NonNull | ||||
|     private final ExecutorService executorService = Executors.newCachedThreadPool(); | ||||
|     private final ExecutorService executorService = new ThreadPoolExecutor( | ||||
|             0, | ||||
|             1_000, | ||||
|             5, | ||||
|             TimeUnit.SECONDS, | ||||
|             new SynchronousQueue<>() | ||||
|     ); | ||||
| 
 | ||||
|     public LabyrinthServer(@NonNull final ServerConfig config) throws IOException, URISyntaxException { | ||||
|         this.httpServer = HttpServer.create(new InetSocketAddress(config.getAddress(), config.getPort()), 5); | ||||
|  |  | |||
|  | @ -4,7 +4,6 @@ import org.junit.jupiter.api.BeforeEach; | |||
| import org.junit.jupiter.api.Test; | ||||
| 
 | ||||
| import java.net.UnknownHostException; | ||||
| import java.util.Properties; | ||||
| 
 | ||||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||||
| import static org.junit.jupiter.api.Assertions.assertThrows; | ||||
|  | @ -12,7 +11,8 @@ import static org.junit.jupiter.api.Assertions.assertThrows; | |||
| class ServerConfigTest { | ||||
|     @BeforeEach | ||||
|     void clearSysProperties() { | ||||
|         System.setProperties(new Properties()); | ||||
|         System.clearProperty(ServerConfig.SYSPROP_HOST); | ||||
|         System.clearProperty(ServerConfig.SYSPROP_PORT); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue