Java has always shipped solid networking right in the standard library: java.net sockets and InetAddress, Java 11's HTTP/2-capable java.net.http.HttpClient (replacing clumsy HttpURLConnection), and Java 18's Simple Web Server.
More lessons in Complete Core Java