Class SocketFactory


  • public class SocketFactory
    extends Object
    A factory class for creating TCP and SSL sockets based on a given URI. It supports both HTTP and HTTPS connections and allows filtering of IP versions.
    • Constructor Detail

      • SocketFactory

        public SocketFactory()
    • Method Detail

      • createSocket

        public Socket createSocket​(URI uri)
        Creates a socket for the given URI.
        Parameters:
        uri - The URI to connect to.
        Returns:
        A new Socket connected to the specified URI.
        Throws:
        RuntimeException - If an error occurs while creating the socket.
      • createSocket

        public Socket createSocket​(URI uri,
                                   IPVersionFilter ipVersionFilter)
        Creates a socket for the given URI with an IP version filter.
        Parameters:
        uri - The URI to connect to.
        ipVersionFilter - The filter to use for resolving the host IP.
        Returns:
        A new Socket connected to the specified URI.
        Throws:
        RuntimeException - If an error occurs while creating the socket.