What causes an Unexpected HTTP Error within install plugins?

You can use the following code to dump the HTTP Api response, will help you figure out the cause of error.

function dump_http_api_response($response, $type="", $transport=null ) {
    if ( $type == "response" )
        var_dump ( $response );
}
add_action('http_api_debug', 'dump_http_api_response', 1, 3);

Example Output:

object(WP_Error)#15 (2) { ["errors"]=> array(1) { ["http_request_failed"]=> array(1) { [0]=> string(41) "Couldn't resolve host 'api.wordpress.org'" } } ["error_data"]=> array(0) { } }