(String[] args)
| 9 | public class Hello { |
| 10 | |
| 11 | public static void main(String[] args) throws IOException { |
| 12 | var body = "hello world".getBytes(); |
| 13 | var server = HttpServer.create(new InetSocketAddress(8080), 0); |
| 14 | server.setExecutor(Executors.newVirtualThreadPerTaskExecutor()); |
| 15 | server.createContext("/").setHandler(exchange -> { |
| 16 | exchange.sendResponseHeaders(200, body.length); |
| 17 | try (var os = exchange.getResponseBody()) { |
| 18 | os.write(body); |
| 19 | } |
| 20 | }); |
| 21 | server.start(); |
| 22 | System.out.println("ready"); |
| 23 | } |
| 24 | |
| 25 | } |
nothing calls this directly
no outgoing calls
no test coverage detected