try
{
// Loop over the whole content, since handle() only
// reads up to the connection buffer's capacities
while (endPoint.getIn().length() > 0)
connection.handle();
byte[] responseBytes = endPoint.getOut().asArray();
RHTTPResponse response = RHTTPResponse.fromResponseBytes(request.getId(), responseBytes);
client.deliver(response);
}