'Basic test of IOStream\'s ability to return Futures.'

@gen_test
def test_future_interface(self):

    stream = self._make_client_iostream()
    connect_result = (yield stream.connect(('127.0.0.1', self.get_http_port())))
    self.assertIs(connect_result, stream)
    (yield stream.write('GET    /    HTTP/1.0\r\n\r\n'))
    first_line = (yield stream.read_until('\r\n'))
    self.assertEqual(first_line, 'HTTP/1.1    200    OK\r\n')
    header_data = (yield stream.read_until('\r\n\r\n', callback=None))
    headers = HTTPHeaders.parse(header_data.decode('latin1'))
    content_length = int(headers['Content-Length'])
    body = (yield stream.read_bytes(content_length))
    self.assertEqual(body, 'Hello')
    stream.close()
