rackerlabs/gdeproxy — pull request #19 by izrik (2013-08-13 19:29:04+00:00)
Title: Unique connection numbers

In order to test HTTP behavior relating to TCP connection (e.g. connection pooling), we need a way to identity individual TCP connections. The threads that handle requests already have a name that includes a connection number, but these numbers are not unique among multiple endpoints. Endpoint 1's "Connection 1" is a different connection from Endpoint 2's "Connection 1". Instead, we need a way to assign unique connection numbers or names to individual sockets returned by Socket.accept(), and associate those names/numbers with handlings.

This pull request creates such a set of unique identifiers for TCP connections using UUID's. The UUID for a connection is added to the Handling object that an Endpoint creates when it handles an incoming requests. Because the endpoint handler thread works in a loop, any subsequent requests on that connection will result in subsequent Handlings objects with the same connectionName added.

Also, this pull request fixes the default client connector, makes ApacheClientConnector re-use its HttpClient, turns on connection re-use in endpoints by default, and refactors the endpoint listener thread and handler thread classes into DeproxyEndpoint.