Module aeonics.core

Class Network

    • Constructor Detail

      • Network

        public Network()
    • Method Detail

      • manager

        public final java.lang.Class<? extends Manager.Type> manager()
        Hardcoded manager type
        Specified by:
        manager in class Manager.Type
        Returns:
        the type of manager
      • keyManager

        public static javax.net.ssl.KeyManager keyManager​(Network.SecurityOptions options,
                                                          boolean clientMode)
        Returns a key manager that matches the provided security options. This is useful to initialize SSL connections.
        Parameters:
        options - the security options (may be null)
        clientMode - whether or not the role is client (or otherwise server)
        Returns:
        a matching key manager
      • trustManager

        public static javax.net.ssl.TrustManager trustManager​(Network.SecurityOptions options)
        Returns a trust manager that matches the provided security options. This is useful to initialize SSL connections.
        Parameters:
        options - the security options (may be null)
        Returns:
        a matching trust manager
      • sslEngine

        public static javax.net.ssl.SSLEngine sslEngine​(Network.SecurityOptions options,
                                                        boolean clientMode)
        Returns an ssl engine that matches the provided security options
        Parameters:
        options - the security options (may be null)
        clientMode - whether or not the role is client (or otherwise server)
        Returns:
        a matching ssl engine
      • sslContext

        public static javax.net.ssl.SSLContext sslContext​(Network.SecurityOptions options,
                                                          boolean clientMode)
        Returns an ssl context that matches the provided security options
        Parameters:
        options - the security options (may be null)
        clientMode - whether or not the role is client (or otherwise server)
        Returns:
        a matching ssl context
      • client

        public Network.Connection client​(java.lang.String remoteAddress,
                                         int remotePort)
                                  throws java.io.IOException
        Establishes a client connection to the specified remote network endpoint. This is equivalent to calling client(String, int, SecurityOptions) without security options.
        Parameters:
        remoteAddress - the remote ip address
        remotePort - the remote port number
        Returns:
        the connected network connection
        Throws:
        java.io.IOException - if a underlying I/O error happens
      • client

        public abstract Network.Connection client​(java.lang.String remoteAddress,
                                                  int remotePort,
                                                  Network.SecurityOptions options)
                                           throws java.io.IOException
        Establishes a secure client connection to the specified remote network endpoint.
        Parameters:
        remoteAddress - the remote ip address
        remotePort - the remote port number
        options - the client security options for this connection, may be null to specify "without security options"
        Returns:
        the connected network connection
        Throws:
        java.io.IOException - if a underlying I/O error happens
      • server

        public Network.Server server​(java.lang.String localAddress,
                                     int localPort)
                              throws java.io.IOException
        Opens a server that listens for incoming network connections. This is equivalent to calling server(String, int, SecurityOptions) without security options.
        Parameters:
        localAddress - the local ip address
        localPort - the local port number
        Returns:
        the connected network channel
        Throws:
        java.io.IOException - if a underlying I/O error happens
      • server

        public abstract Network.Server server​(java.lang.String localAddress,
                                              int localPort,
                                              Network.SecurityOptions options)
                                       throws java.io.IOException
        Opens a server that listens for incoming network connections
        Parameters:
        localAddress - the local ip address
        localPort - the local port number
        options - the server security options to apply to all clients, may be null to specify "without security options"
        Returns:
        the connected network channel
        Throws:
        java.io.IOException - if a underlying I/O error happens
      • refresh

        public abstract void refresh()
        This method forces the network manager to refresh its internal state if necessary.