def test_parse
@response.version = nil
@response.status = 0
assert_nil(@response.version)
assert_equal(0, @response.status)
assert_equal('Unknown', @response.reason)
pio = PseudoIO.new
pio << "HTTP/1.1 200 OK\r\n"
pio << "Content-Type: text/html\r\n"
pio << "\r\n"
pio << "<html>Hello world.</html>\n"
@response.parse(pio)
assert_equal('HTTP/1.1', @response.version)
assert_equal(200, @response.status)
assert_equal('OK', @response.reason)
assert_equal('text/html', @response.header('Content-Type'))
assert_equal("<html>Hello world.</html>\n", pio.read)
end