The outermost curly braces prevent variable expansion/interpretation of commands in TCL. You should be able to use subst (
Click here) to force evaluation of the [HTTP::uri] command within the curly braces:
HTTP::respond 404 content [subst {test URI: [HTTP::uri] }] noserver
The Connection and Content-Length headers are inserted automatically. You could try setting a Connection: Close header, but I'm guessing it would be appended to the request and not replace the Connection: Keep-Alive header.
HTTP::respond 404 content [subst {test URI: [HTTP::uri] }] noserver Connection Close
And LTM needs to insert the Content-Length header in order to tell the client how much data will be sent.
Aaron