| 3 | import java.net.Socket; |
| 4 | |
| 5 | public class JavaHTTPServer { |
| 6 | public static void main(String[] args) { |
| 7 | var count = 0; // count used to introduce delays |
| 8 | // bind listener |
| 9 | try (var serverSocket = new ServerSocket(8080, 100)) { |
| 10 | System.out.println("Server is listening on port 8080"); |
| 11 | while (true) { |
| 12 | count++; |
| 13 | // listen to all incoming requests and spawn each connection in a new thread |
| 14 | new ServerThread(serverSocket.accept(), count).start(); |
| 15 | } |
| 16 | } catch (IOException ex) { |
| 17 | System.out.println("Server exception: " + ex.getMessage()); |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 |
nothing calls this directly
no outgoing calls
no test coverage detected