10 Java Networking

The Java networking API provides classes for networking functionality, including addressing, classes for using URLs and URIs, socket classes for connecting to servers, networking security functionality, and more. It consists of these packages and modules:

  • java.net: Classes for implementing networking applications. You can alter the mechanisms and behavior of the various classes of this package through networking properties, which are standard system properties. See Networking Properties for a list of these properties.

  • java.net.http: Contains the API for the HTTP Client, which provides high-level client interfaces to HTTP (versions 1.1, 2, and 3) and low-level client interfaces to WebSocket instances.

    The java.net.http module summary lists system networking properties used by the HTTP Client API. The properties listed in Networking Properties, which typically affect java.base, can affect the HTTP Client.

    See Java HTTP Client for more information about this API, including videos and sample code.

    Note:

    You can use the jwebserver tool for testing and debugging your client application.
  • javax.net: Classes for creating sockets.

  • javax.net.ssl: Secure socket classes.

  • jdk.httpserver: Platform-specific APIs for building HTTP servers for educational and testing purposes, as well as the jwebserver tool for running a minimal HTTP server.

  • jdk.net: Platform-specific socket options for the java.net and java.nio.channels socket classes.