aristidb/aws — pull request #132 by larskuhtz (2014-08-30 15:45:57+00:00)
Title: Connection reuse

The http-client package flags TCP connection for reuse for another HTTP request only if it is guaranteed that there is no stale data from the response of the previous request in the channel. Consumption of all data is detected by reading data chunks from the response body until a final empty chunk is read that signals that the end of the input has been reached.

For certain protocols, such as JSON or XML, a consumer can determine the end of the response data without actually reading the final empty chunk. For instance for JSON the consumer simply requests data until the outermost object or array value is complete. Even though all bytes from the response are consumed and the response body reader is properly closed, the final empty chunk is not forced and reuse of the TCP connection isn't triggered.

The final patch in this series fixes the response consumer of DynamoDb to trigger the reuse of TCP connections by reading the final empty chunk that indicates end-of-stream.

The remaining patches add tests for SQS and DynamoDb to check that TCP connections are actually reused.