Class ProxyResponseImpl

    • Method Detail

      • create

        public static ProxyResponse create​(ByteBuffer buffer)
        Create a proxy response from a given buffer. Assumes that the buffer has been flipped.
        Parameters:
        buffer - Buffer which could parse to a proxy response.
        Returns:
        A new instance of ProxyResponseImpl representing the given buffer.
        Throws:
        IllegalArgumentException - if buffer have no content to read.
      • getError

        public String getError()
        Gets the HTTP response body as an error.
        Specified by:
        getError in interface ProxyResponse
        Returns:
        If there is no HTTP response body, an empty string is returned.
      • isMissingContent

        public boolean isMissingContent()
        Gets whether or not the HTTP response is complete. An HTTP response is complete when the HTTP header and body are received.
        Specified by:
        isMissingContent in interface ProxyResponse
        Returns:
        true if the HTTP response is complete, and false otherwise.
      • addContent

        public void addContent​(ByteBuffer content)
        Adds additional content to the HTTP response's body. Assumes that the content has been flipped.
        Specified by:
        addContent in interface ProxyResponse
        Parameters:
        content - Content to add to the body of the HTTP response.
        Throws:
        NullPointerException - if content is null.
        IllegalArgumentException - if content have no content to read.
      • hasConnectionCloseHeader

        public boolean hasConnectionCloseHeader()
        Checks if the HTTP response for CONNECT has a "Connection: close" header.
        Specified by:
        hasConnectionCloseHeader in interface ProxyResponse
        Returns:
        true if the HTTP response has a "Connection: close" header, and false otherwise.