Class ProxyConnectionFactory.ProxyEndPoint

    • Constructor Detail

      • ProxyEndPoint

        public ProxyEndPoint​(EndPoint endp,
                             java.net.InetSocketAddress remote,
                             java.net.InetSocketAddress local)
    • Method Detail

      • isOptimizedForDirectBuffers

        public boolean isOptimizedForDirectBuffers()
        Description copied from interface: EndPoint
        Is the endpoint optimized for DirectBuffer usage
        Specified by:
        isOptimizedForDirectBuffers in interface EndPoint
        Returns:
        True if direct buffers can be used optimally.
      • getLocalAddress

        public java.net.InetSocketAddress getLocalAddress()
        Specified by:
        getLocalAddress in interface EndPoint
        Returns:
        The local Inet address to which this EndPoint is bound, or null if this EndPoint does not represent a network connection.
      • getRemoteAddress

        public java.net.InetSocketAddress getRemoteAddress()
        Specified by:
        getRemoteAddress in interface EndPoint
        Returns:
        The remote Inet address to which this EndPoint is bound, or null if this EndPoint does not represent a network connection.
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface EndPoint
      • shutdownOutput

        public void shutdownOutput()
        Description copied from interface: EndPoint
        Shutdown the output.

        This call indicates that no more data will be sent on this endpoint that that the remote end should read an EOF once all previously sent data has been consumed. Shutdown may be done either at the TCP/IP level, as a protocol exchange (Eg TLS close handshake) or both.

        If the endpoint has EndPoint.isInputShutdown() true, then this call has the same effect as EndPoint.close().

        Specified by:
        shutdownOutput in interface EndPoint
      • isInputShutdown

        public boolean isInputShutdown()
        Description copied from interface: EndPoint
        Test if the input is shutdown. The input is shutdown if an EOF has been read while doing a EndPoint.fill(ByteBuffer). Once the input is shutdown, all calls to EndPoint.fill(ByteBuffer) will return -1, until such time as the end point is close, when they will return EofException.
        Specified by:
        isInputShutdown in interface EndPoint
        Returns:
        True if the input is shutdown or the endpoint is closed.
      • close

        public void close()
        Description copied from interface: EndPoint
        Close any backing stream associated with the endpoint
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface EndPoint
      • fill

        public int fill​(java.nio.ByteBuffer buffer)
                 throws java.io.IOException
        Description copied from interface: EndPoint
        Fill the passed buffer with data from this endpoint. The bytes are appended to any data already in the buffer by writing from the buffers limit up to it's capacity. The limit is updated to include the filled bytes.
        Specified by:
        fill in interface EndPoint
        Parameters:
        buffer - The buffer to fill. The position and limit are modified during the fill. After the operation, the position is unchanged and the limit is increased to reflect the new data filled.
        Returns:
        an int value indicating the number of bytes filled or -1 if EOF is read or the input is shutdown.
        Throws:
        java.io.IOException - if the endpoint is closed.
      • flush

        public boolean flush​(java.nio.ByteBuffer... buffer)
                      throws java.io.IOException
        Description copied from interface: EndPoint
        Flush data from the passed header/buffer to this endpoint. As many bytes as can be consumed are taken from the header/buffer position up until the buffer limit. The header/buffers position is updated to indicate how many bytes have been consumed.
        Specified by:
        flush in interface EndPoint
        Parameters:
        buffer - the buffers to flush
        Returns:
        True IFF all the buffers have been consumed and the endpoint has flushed the data to its destination (ie is not buffering any data).
        Throws:
        java.io.IOException - If the endpoint is closed or output is shutdown.
      • getTransport

        public java.lang.Object getTransport()
        Specified by:
        getTransport in interface EndPoint
        Returns:
        The underlying transport object (socket, channel, etc.)
      • getIdleTimeout

        public long getIdleTimeout()
        Description copied from interface: EndPoint
        Get the max idle time in ms.

        The max idle time is the time the endpoint can be idle before extraordinary handling takes place.

        Specified by:
        getIdleTimeout in interface EndPoint
        Returns:
        the max idle time in ms or if ms <= 0 implies an infinite timeout
      • setIdleTimeout

        public void setIdleTimeout​(long idleTimeout)
        Description copied from interface: EndPoint
        Set the idle timeout.
        Specified by:
        setIdleTimeout in interface EndPoint
        Parameters:
        idleTimeout - the idle timeout in MS. Timeout <= 0 implies an infinite timeout
      • fillInterested

        public void fillInterested​(Callback callback)
                            throws java.nio.channels.ReadPendingException
        Description copied from interface: EndPoint

        Requests callback methods to be invoked when a call to EndPoint.fill(ByteBuffer) would return data or EOF.

        Specified by:
        fillInterested in interface EndPoint
        Parameters:
        callback - the callback to call when an error occurs or we are readable. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.
        Throws:
        java.nio.channels.ReadPendingException - if another read operation is concurrent.
      • tryFillInterested

        public boolean tryFillInterested​(Callback callback)
        Description copied from interface: EndPoint

        Requests callback methods to be invoked when a call to EndPoint.fill(ByteBuffer) would return data or EOF.

        Specified by:
        tryFillInterested in interface EndPoint
        Parameters:
        callback - the callback to call when an error occurs or we are readable. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.
        Returns:
        true if set
      • write

        public void write​(Callback callback,
                          java.nio.ByteBuffer... buffers)
                   throws java.nio.channels.WritePendingException
        Description copied from interface: EndPoint

        Writes the given buffers via EndPoint.flush(ByteBuffer...) and invokes callback methods when either all the data has been flushed or an error occurs.

        Specified by:
        write in interface EndPoint
        Parameters:
        callback - the callback to call when an error occurs or the write completed. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.
        buffers - one or more ByteBuffers that will be flushed.
        Throws:
        java.nio.channels.WritePendingException - if another write operation is concurrent.
      • upgrade

        public void upgrade​(Connection newConnection)
        Description copied from interface: EndPoint
        Upgrade connections. Close the old connection, update the endpoint and open the new connection. If the oldConnection is an instance of Connection.UpgradeFrom then a prefilled buffer is requested and passed to the newConnection if it is an instance of Connection.UpgradeTo
        Specified by:
        upgrade in interface EndPoint
        Parameters:
        newConnection - The connection to upgrade to