def test_http_close_connection(server):
    client = HttpClient("localhost", server.port, disable_certificate_validation=True,)

    status, _ = client.send_request()
    assert status == 200

    connection = client._connection_attr
    client.close_connection()
    assert client._connection_attr is None
    assert connection.pool is None

    # Verify that subsequent calls to close_connection don't crash
    client.close_connection()
def test_http_close_connection_in_context_manager():
    client = HttpClient("localhost", 1000)
    with client:
        client.close_connection()