org.apache.hc.core5.http.io

## Interface ResponseOutOfOrderStrategy

- All Known Implementing Classes:
    MonitoringResponseOutOfOrderStrategy, NoResponseOutOfOrderStrategy

      @Internal
      public interface ResponseOutOfOrderStrategy

  Represents a strategy to determine how frequently the client should check for an out of order response. An out of order response is sent before the server has read the full request. If the client fails to check for an early response then a `SocketException` or `SocketTimeoutException` may be thrown while writing the request entity after a timeout is reached on either the client or server.
  Since:
    5.1

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isEarlyResponseDetected(ClassicHttpRequest request, HttpClientConnection connection, InputStream inputStream, long totalBytesSent, long nextWriteSize)` Called before each write to the socket `IOException` with the number of bytes that have already been sent, and the size of the next chunk to be written that will occur if this check does not encounter an out of order response.

- - ### Method Detail

    - #### isEarlyResponseDetected

          boolean isEarlyResponseDetected(ClassicHttpRequest request,
                                          HttpClientConnection connection,
                                          InputStream inputStream,
                                          long totalBytesSent,
                                          long nextWriteSize)
                                   throws IOException

      Called before each write to the socket `IOException` with the number of bytes that have already been sent, and the size of the next chunk to be written that will occur if this check does not encounter an out of order response.
      Parameters:
        `request` - The current request.
        `connection` - The connection used to send the current request.
        `inputStream` - The response stream, this may be used to check for an early response.
        `totalBytesSent` - Number of bytes that have already been sent.
        `nextWriteSize` - The size of a socket write operation that will follow this check.
      Returns:
        True if an early response was detected, otherwise false.
      Throws:
        `IOException` - in case of a network failure while checking for an early response.

Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.