Class ClientConnector.Configurator

    • Constructor Detail

      • Configurator

        public Configurator()
    • Method Detail

      • isIntrinsicallySecure

        public boolean isIntrinsicallySecure​(ClientConnector clientConnector,
                                             java.net.SocketAddress address)

        Returns whether the connection to a given SocketAddress is intrinsically secure.

        A protocol such as HTTP/1.1 can be transported by TCP; however, TCP is not secure because it does not offer any encryption.

        Encryption is provided by using TLS to wrap the HTTP/1.1 bytes, and then transporting the TLS bytes over TCP.

        On the other hand, protocols such as QUIC are intrinsically secure, and therefore it is not necessary to wrap the HTTP/1.1 bytes with TLS: the HTTP/1.1 bytes are transported over QUIC in an intrinsically secure way.

        Parameters:
        clientConnector - the ClientConnector
        address - the SocketAddress to connect to
        Returns:
        whether the connection to the given SocketAddress is intrinsically secure
      • newChannelWithAddress

        public ClientConnector.Configurator.ChannelWithAddress newChannelWithAddress​(ClientConnector clientConnector,
                                                                                     java.net.SocketAddress address,
                                                                                     java.util.Map<java.lang.String,​java.lang.Object> context)
                                                                              throws java.io.IOException

        Creates a new SocketChannel to connect to a SocketAddress derived from the input socket address.

        The input socket address represents the destination socket address to connect to, as it is typically specified by a URI authority, for example localhost:8080 if the URI is http://localhost:8080/path.

        However, the returned socket address may be different as the implementation may use a Unix-Domain socket address to physically connect to the virtual destination socket address given as input.

        The return type is a pair/record holding the socket channel and the socket address, with the socket channel not yet connected. The implementation of this methods must not call SocketChannel.connect(SocketAddress), as this is done later, after configuring the socket, by the ClientConnector implementation.

        Parameters:
        address - the destination socket address, typically specified in a URI
        context - the context to create the new socket channel
        Returns:
        a new SocketChannel with an associated SocketAddress to connect to
        Throws:
        java.io.IOException - if the socket channel or the socket address cannot be created
      • newEndPoint

        public EndPoint newEndPoint​(ClientConnector clientConnector,
                                    java.net.SocketAddress address,
                                    java.nio.channels.SelectableChannel selectable,
                                    ManagedSelector selector,
                                    java.nio.channels.SelectionKey selectionKey)
      • newConnection

        public Connection newConnection​(ClientConnector clientConnector,
                                        java.net.SocketAddress address,
                                        EndPoint endPoint,
                                        java.util.Map<java.lang.String,​java.lang.Object> context)
                                 throws java.io.IOException
        Throws:
        java.io.IOException