Class AFUNIXSocketFactory

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  AFUNIXSocketFactory.FactoryArg
      A socket factory that handles a custom hostname ("junixsocket.localhost", by default, and configured by the system property "org.newsclub.net.unix.socket.hostname"), forwarding all other requests to the fallback SocketFactory.
      static class  AFUNIXSocketFactory.SystemProperty
      A socket factory that handles a custom hostname ("junixsocket.localhost", by default, and configured by the system property "org.newsclub.net.unix.socket.hostname"), forwarding all other requests to the fallback SocketFactory.
      static class  AFUNIXSocketFactory.URIScheme
      A socket factory that handles special host names formatted as file:// URIs.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract AFUNIXSocketAddress addressFromHost​(java.lang.String host, int port)
      Translates a "host" string (and port) to an AFUNIXSocketAddress.
      java.net.Socket createSocket()  
      java.net.Socket createSocket​(java.lang.String host, int port)  
      java.net.Socket createSocket​(java.lang.String host, int port, java.net.InetAddress localHost, int localPort)  
      java.net.Socket createSocket​(java.net.InetAddress address, int port)  
      java.net.Socket createSocket​(java.net.InetAddress address, int port, java.net.InetAddress localAddress, int localPort)  
      protected boolean isHostnameSupported​(java.lang.String host)
      Checks whether the given hostname is supported by this socket factory.
      protected boolean isInetAddressSupported​(java.net.InetAddress address)
      Checks whether the given InetAddress is supported by this socket factory.
      • Methods inherited from class javax.net.SocketFactory

        getDefault
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AFUNIXSocketFactory

        public AFUNIXSocketFactory()
    • Method Detail

      • addressFromHost

        protected abstract AFUNIXSocketAddress addressFromHost​(java.lang.String host,
                                                               int port)
                                                        throws java.io.IOException
        Translates a "host" string (and port) to an AFUNIXSocketAddress.
        Parameters:
        host - The hostname
        port - The port, or 0.
        Returns:
        The AFUNIXSocketAddress
        Throws:
        java.io.IOException - If there was a problem converting the hostname
        java.lang.NullPointerException - If host was null.
      • isHostnameSupported

        protected boolean isHostnameSupported​(java.lang.String host)
        Checks whether the given hostname is supported by this socket factory. If not, calls to createSocket will cause an UnknownHostException.
        Parameters:
        host - The host to check.
        Returns:
        true if supported.
      • isInetAddressSupported

        protected boolean isInetAddressSupported​(java.net.InetAddress address)
        Checks whether the given InetAddress is supported by this socket factory. If not, calls to createSocket will cause an UnknownHostException. By default, this only checks the hostname part of the address via isHostnameSupported(String).
        Parameters:
        address - The address to check.
        Returns:
        true if supported.
      • createSocket

        public java.net.Socket createSocket()
                                     throws java.io.IOException
        Overrides:
        createSocket in class javax.net.SocketFactory
        Throws:
        java.io.IOException
      • createSocket

        public java.net.Socket createSocket​(java.lang.String host,
                                            int port)
                                     throws java.io.IOException,
                                            java.net.UnknownHostException
        Specified by:
        createSocket in class javax.net.SocketFactory
        Throws:
        java.io.IOException
        java.net.UnknownHostException
      • createSocket

        public java.net.Socket createSocket​(java.lang.String host,
                                            int port,
                                            java.net.InetAddress localHost,
                                            int localPort)
                                     throws java.io.IOException,
                                            java.net.UnknownHostException
        Specified by:
        createSocket in class javax.net.SocketFactory
        Throws:
        java.io.IOException
        java.net.UnknownHostException
      • createSocket

        public java.net.Socket createSocket​(java.net.InetAddress address,
                                            int port)
                                     throws java.io.IOException
        Specified by:
        createSocket in class javax.net.SocketFactory
        Throws:
        java.io.IOException
      • createSocket

        public java.net.Socket createSocket​(java.net.InetAddress address,
                                            int port,
                                            java.net.InetAddress localAddress,
                                            int localPort)
                                     throws java.io.IOException
        Specified by:
        createSocket in class javax.net.SocketFactory
        Throws:
        java.io.IOException