We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
urllib3.ProxyManager() instantiation is broken.
python 3.7.5
httpx 0.11.0
urllib3 1.25.7

```
$ ipython3 -c 'import httpx; r = httpx.get("https://www.google.com")'
parse_url http://127.0.0.1:1234 <class 'httpx.models.URL'>
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-d6fe3101235f> in <module>
----> 1 import httpx; r = httpx.get("https://www.google.com")

/usr/local/lib/python3.7/site-packages/httpx/api.py in get(url, params, headers, cookies, auth, allow_redirects, cert, verify, timeout, trust_env)
    168         verify=verify,
    169         timeout=timeout,
--> 170         trust_env=trust_env,
    171     )
    172

/usr/local/lib/python3.7/site-packages/httpx/api.py in request(method, url, params, data, files, json, headers, cookies, auth, timeout, allow_redirects, verify, cert, trust_env)
     82     """
     83     with Client(
---> 84         cert=cert, verify=verify, timeout=timeout, trust_env=trust_env,
     85     ) as client:
     86         return client.request(

/usr/local/lib/python3.7/site-packages/httpx/client.py in __init__(self, auth, params, headers, cookies, verify, cert, proxies, timeout, pool_limits, max_redirects, base_url, dispatch, app, trust_env)
    477                 trust_env=trust_env,
    478             )
--> 479             for key, proxy in proxy_map.items()
    480         }
    481

/usr/local/lib/python3.7/site-packages/httpx/client.py in <dictcomp>(.0)
    477                 trust_env=trust_env,
    478             )
--> 479             for key, proxy in proxy_map.items()
    480         }
    481

/usr/local/lib/python3.7/site-packages/httpx/client.py in init_proxy_dispatch(self, proxy, verify, cert, pool_limits, trust_env)
    512             cert=cert,
    513             pool_limits=pool_limits,
--> 514             trust_env=trust_env,
    515         )
    516

/usr/local/lib/python3.7/site-packages/httpx/dispatch/urllib3.py in __init__(self, proxy, verify, cert, trust_env, pool_limits)
     58             num_pools=num_pools,
     59             maxsize=maxsize,
---> 60             block=block,
     61         )
     62

/usr/local/lib/python3.7/site-packages/httpx/dispatch/urllib3.py in init_pool_manager(self, proxy, ssl_context, num_pools, maxsize, block)
     83                 num_pools=num_pools,
     84                 maxsize=maxsize,
---> 85                 block=block,
     86             )
     87

/usr/local/lib/python3.7/site-packages/urllib3/poolmanager.py in __init__(self, proxy_url, num_pools, headers, proxy_headers, **connection_pool_kw)
    412                 proxy_url.port,
    413             )
--> 414         proxy = parse_url(proxy_url)
    415         if not proxy.port:
    416             port = port_by_scheme.get(proxy.scheme, 80)

/usr/local/lib/python3.7/site-packages/urllib3/util/url.py in parse_url(url)
    361     print('parse_url', url, type(url))
    362     source_url = url
--> 363     if not SCHEME_RE.search(url):
    364         url = "//" + url
    365

TypeError: expected string or bytes-like object
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `httpx/dispatch/urllib3.py`
Content:
```
1 import math
2 import socket
3 import ssl
4 import typing
5 
6 import urllib3
7 from urllib3.exceptions import MaxRetryError, SSLError
8 
9 from ..config import (
10     DEFAULT_POOL_LIMITS,
11     CertTypes,
12     PoolLimits,
13     Proxy,
14     SSLConfig,
15     Timeout,
16     VerifyTypes,
17 )
18 from ..content_streams import IteratorStream
19 from ..models import Request, Response
20 from ..utils import as_network_error
21 from .base import SyncDispatcher
22 
23 
24 class URLLib3Dispatcher(SyncDispatcher):
25     def __init__(
26         self,
27         *,
28         proxy: Proxy = None,
29         verify: VerifyTypes = True,
30         cert: CertTypes = None,
31         trust_env: bool = None,
32         pool_limits: PoolLimits = DEFAULT_POOL_LIMITS,
33     ):
34         ssl_config = SSLConfig(
35             verify=verify, cert=cert, trust_env=trust_env, http2=False
36         )
37         hard_limit = pool_limits.hard_limit
38         soft_limit = pool_limits.soft_limit
39 
40         # Our connection pool configuration doesn't quite match up with urllib3's
41         # controls, but we can put sensible mappings in place:
42         if hard_limit is None:
43             block = False
44             if soft_limit is None:
45                 num_pools = 1000
46                 maxsize = 1000
47             else:
48                 num_pools = int(math.sqrt(soft_limit))
49                 maxsize = int(math.sqrt(soft_limit))
50         else:
51             block = True
52             num_pools = int(math.sqrt(hard_limit))
53             maxsize = int(math.sqrt(hard_limit))
54 
55         self.pool = self.init_pool_manager(
56             proxy=proxy,
57             ssl_context=ssl_config.ssl_context,
58             num_pools=num_pools,
59             maxsize=maxsize,
60             block=block,
61         )
62 
63     def init_pool_manager(
64         self,
65         proxy: typing.Optional[Proxy],
66         ssl_context: ssl.SSLContext,
67         num_pools: int,
68         maxsize: int,
69         block: bool,
70     ) -> typing.Union[urllib3.PoolManager, urllib3.ProxyManager]:
71         if proxy is None:
72             return urllib3.PoolManager(
73                 ssl_context=ssl_context,
74                 num_pools=num_pools,
75                 maxsize=maxsize,
76                 block=block,
77             )
78         else:
79             return urllib3.ProxyManager(
80                 proxy_url=proxy.url,
81                 proxy_headers=dict(proxy.headers),
82                 ssl_context=ssl_context,
83                 num_pools=num_pools,
84                 maxsize=maxsize,
85                 block=block,
86             )
87 
88     def send(self, request: Request, timeout: Timeout = None) -> Response:
89         timeout = Timeout() if timeout is None else timeout
90         urllib3_timeout = urllib3.util.Timeout(
91             connect=timeout.connect_timeout, read=timeout.read_timeout
92         )
93         chunked = request.headers.get("Transfer-Encoding") == "chunked"
94         content_length = int(request.headers.get("Content-Length", "0"))
95         body = request.stream if chunked or content_length else None
96 
97         with as_network_error(MaxRetryError, SSLError, socket.error):
98             conn = self.pool.urlopen(
99                 method=request.method,
100                 url=str(request.url),
101                 headers=dict(request.headers),
102                 body=body,
103                 redirect=False,
104                 assert_same_host=False,
105                 retries=0,
106                 preload_content=False,
107                 chunked=chunked,
108                 timeout=urllib3_timeout,
109                 pool_timeout=timeout.pool_timeout,
110             )
111 
112         def response_bytes() -> typing.Iterator[bytes]:
113             with as_network_error(socket.error):
114                 for chunk in conn.stream(4096, decode_content=False):
115                     yield chunk
116 
117         return Response(
118             status_code=conn.status,
119             http_version="HTTP/1.1",
120             headers=list(conn.headers.items()),
121             stream=IteratorStream(
122                 iterator=response_bytes(), close_func=conn.release_conn
123             ),
124             request=request,
125         )
126 
127     def close(self) -> None:
128         self.pool.clear()
129
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/httpx/dispatch/urllib3.py b/httpx/dispatch/urllib3.py
--- a/httpx/dispatch/urllib3.py
+++ b/httpx/dispatch/urllib3.py
@@ -77,7 +77,7 @@
             )
         else:
             return urllib3.ProxyManager(
-                proxy_url=proxy.url,
+                proxy_url=str(proxy.url),
                 proxy_headers=dict(proxy.headers),
                 ssl_context=ssl_context,
                 num_pools=num_pools,

{"golden_diff": "diff --git a/httpx/dispatch/urllib3.py b/httpx/dispatch/urllib3.py\n--- a/httpx/dispatch/urllib3.py\n+++ b/httpx/dispatch/urllib3.py\n@@ -77,7 +77,7 @@\n             )\n         else:\n             return urllib3.ProxyManager(\n-                proxy_url=proxy.url,\n+                proxy_url=str(proxy.url),\n                 proxy_headers=dict(proxy.headers),\n                 ssl_context=ssl_context,\n                 num_pools=num_pools,\n", "issue": "urllib3.ProxyManager() instantiation is broken.\npython 3.7.5\r\nhttpx 0.11.0\r\nurllib3 1.25.7\r\n\r\n```\r\n$ ipython3 -c 'import httpx; r = httpx.get(\"https://www.google.com\")'\r\nparse_url http://127.0.0.1:1234 <class 'httpx.models.URL'>\r\n---------------------------------------------------------------------------\r\nTypeError                                 Traceback (most recent call last)\r\n<ipython-input-1-d6fe3101235f> in <module>\r\n----> 1 import httpx; r = httpx.get(\"https://www.google.com\")\r\n\r\n/usr/local/lib/python3.7/site-packages/httpx/api.py in get(url, params, headers, cookies, auth, allow_redirects, cert, verify, timeout, trust_env)\r\n    168         verify=verify,\r\n    169         timeout=timeout,\r\n--> 170         trust_env=trust_env,\r\n    171     )\r\n    172\r\n\r\n/usr/local/lib/python3.7/site-packages/httpx/api.py in request(method, url, params, data, files, json, headers, cookies, auth, timeout, allow_redirects, verify, cert, trust_env)\r\n     82     \"\"\"\r\n     83     with Client(\r\n---> 84         cert=cert, verify=verify, timeout=timeout, trust_env=trust_env,\r\n     85     ) as client:\r\n     86         return client.request(\r\n\r\n/usr/local/lib/python3.7/site-packages/httpx/client.py in __init__(self, auth, params, headers, cookies, verify, cert, proxies, timeout, pool_limits, max_redirects, base_url, dispatch, app, trust_env)\r\n    477                 trust_env=trust_env,\r\n    478             )\r\n--> 479             for key, proxy in proxy_map.items()\r\n    480         }\r\n    481\r\n\r\n/usr/local/lib/python3.7/site-packages/httpx/client.py in <dictcomp>(.0)\r\n    477                 trust_env=trust_env,\r\n    478             )\r\n--> 479             for key, proxy in proxy_map.items()\r\n    480         }\r\n    481\r\n\r\n/usr/local/lib/python3.7/site-packages/httpx/client.py in init_proxy_dispatch(self, proxy, verify, cert, pool_limits, trust_env)\r\n    512             cert=cert,\r\n    513             pool_limits=pool_limits,\r\n--> 514             trust_env=trust_env,\r\n    515         )\r\n    516\r\n\r\n/usr/local/lib/python3.7/site-packages/httpx/dispatch/urllib3.py in __init__(self, proxy, verify, cert, trust_env, pool_limits)\r\n     58             num_pools=num_pools,\r\n     59             maxsize=maxsize,\r\n---> 60             block=block,\r\n     61         )\r\n     62\r\n\r\n/usr/local/lib/python3.7/site-packages/httpx/dispatch/urllib3.py in init_pool_manager(self, proxy, ssl_context, num_pools, maxsize, block)\r\n     83                 num_pools=num_pools,\r\n     84                 maxsize=maxsize,\r\n---> 85                 block=block,\r\n     86             )\r\n     87\r\n\r\n/usr/local/lib/python3.7/site-packages/urllib3/poolmanager.py in __init__(self, proxy_url, num_pools, headers, proxy_headers, **connection_pool_kw)\r\n    412                 proxy_url.port,\r\n    413             )\r\n--> 414         proxy = parse_url(proxy_url)\r\n    415         if not proxy.port:\r\n    416             port = port_by_scheme.get(proxy.scheme, 80)\r\n\r\n/usr/local/lib/python3.7/site-packages/urllib3/util/url.py in parse_url(url)\r\n    361     print('parse_url', url, type(url))\r\n    362     source_url = url\r\n--> 363     if not SCHEME_RE.search(url):\r\n    364         url = \"//\" + url\r\n    365\r\n\r\nTypeError: expected string or bytes-like object\r\n```\n", "before_files": [{"content": "import math\nimport socket\nimport ssl\nimport typing\n\nimport urllib3\nfrom urllib3.exceptions import MaxRetryError, SSLError\n\nfrom ..config import (\n    DEFAULT_POOL_LIMITS,\n    CertTypes,\n    PoolLimits,\n    Proxy,\n    SSLConfig,\n    Timeout,\n    VerifyTypes,\n)\nfrom ..content_streams import IteratorStream\nfrom ..models import Request, Response\nfrom ..utils import as_network_error\nfrom .base import SyncDispatcher\n\n\nclass URLLib3Dispatcher(SyncDispatcher):\n    def __init__(\n        self,\n        *,\n        proxy: Proxy = None,\n        verify: VerifyTypes = True,\n        cert: CertTypes = None,\n        trust_env: bool = None,\n        pool_limits: PoolLimits = DEFAULT_POOL_LIMITS,\n    ):\n        ssl_config = SSLConfig(\n            verify=verify, cert=cert, trust_env=trust_env, http2=False\n        )\n        hard_limit = pool_limits.hard_limit\n        soft_limit = pool_limits.soft_limit\n\n        # Our connection pool configuration doesn't quite match up with urllib3's\n        # controls, but we can put sensible mappings in place:\n        if hard_limit is None:\n            block = False\n            if soft_limit is None:\n                num_pools = 1000\n                maxsize = 1000\n            else:\n                num_pools = int(math.sqrt(soft_limit))\n                maxsize = int(math.sqrt(soft_limit))\n        else:\n            block = True\n            num_pools = int(math.sqrt(hard_limit))\n            maxsize = int(math.sqrt(hard_limit))\n\n        self.pool = self.init_pool_manager(\n            proxy=proxy,\n            ssl_context=ssl_config.ssl_context,\n            num_pools=num_pools,\n            maxsize=maxsize,\n            block=block,\n        )\n\n    def init_pool_manager(\n        self,\n        proxy: typing.Optional[Proxy],\n        ssl_context: ssl.SSLContext,\n        num_pools: int,\n        maxsize: int,\n        block: bool,\n    ) -> typing.Union[urllib3.PoolManager, urllib3.ProxyManager]:\n        if proxy is None:\n            return urllib3.PoolManager(\n                ssl_context=ssl_context,\n                num_pools=num_pools,\n                maxsize=maxsize,\n                block=block,\n            )\n        else:\n            return urllib3.ProxyManager(\n                proxy_url=proxy.url,\n                proxy_headers=dict(proxy.headers),\n                ssl_context=ssl_context,\n                num_pools=num_pools,\n                maxsize=maxsize,\n                block=block,\n            )\n\n    def send(self, request: Request, timeout: Timeout = None) -> Response:\n        timeout = Timeout() if timeout is None else timeout\n        urllib3_timeout = urllib3.util.Timeout(\n            connect=timeout.connect_timeout, read=timeout.read_timeout\n        )\n        chunked = request.headers.get(\"Transfer-Encoding\") == \"chunked\"\n        content_length = int(request.headers.get(\"Content-Length\", \"0\"))\n        body = request.stream if chunked or content_length else None\n\n        with as_network_error(MaxRetryError, SSLError, socket.error):\n            conn = self.pool.urlopen(\n                method=request.method,\n                url=str(request.url),\n                headers=dict(request.headers),\n                body=body,\n                redirect=False,\n                assert_same_host=False,\n                retries=0,\n                preload_content=False,\n                chunked=chunked,\n                timeout=urllib3_timeout,\n                pool_timeout=timeout.pool_timeout,\n            )\n\n        def response_bytes() -> typing.Iterator[bytes]:\n            with as_network_error(socket.error):\n                for chunk in conn.stream(4096, decode_content=False):\n                    yield chunk\n\n        return Response(\n            status_code=conn.status,\n            http_version=\"HTTP/1.1\",\n            headers=list(conn.headers.items()),\n            stream=IteratorStream(\n                iterator=response_bytes(), close_func=conn.release_conn\n            ),\n            request=request,\n        )\n\n    def close(self) -> None:\n        self.pool.clear()\n", "path": "httpx/dispatch/urllib3.py"}], "after_files": [{"content": "import math\nimport socket\nimport ssl\nimport typing\n\nimport urllib3\nfrom urllib3.exceptions import MaxRetryError, SSLError\n\nfrom ..config import (\n    DEFAULT_POOL_LIMITS,\n    CertTypes,\n    PoolLimits,\n    Proxy,\n    SSLConfig,\n    Timeout,\n    VerifyTypes,\n)\nfrom ..content_streams import IteratorStream\nfrom ..models import Request, Response\nfrom ..utils import as_network_error\nfrom .base import SyncDispatcher\n\n\nclass URLLib3Dispatcher(SyncDispatcher):\n    def __init__(\n        self,\n        *,\n        proxy: Proxy = None,\n        verify: VerifyTypes = True,\n        cert: CertTypes = None,\n        trust_env: bool = None,\n        pool_limits: PoolLimits = DEFAULT_POOL_LIMITS,\n    ):\n        ssl_config = SSLConfig(\n            verify=verify, cert=cert, trust_env=trust_env, http2=False\n        )\n        hard_limit = pool_limits.hard_limit\n        soft_limit = pool_limits.soft_limit\n\n        # Our connection pool configuration doesn't quite match up with urllib3's\n        # controls, but we can put sensible mappings in place:\n        if hard_limit is None:\n            block = False\n            if soft_limit is None:\n                num_pools = 1000\n                maxsize = 1000\n            else:\n                num_pools = int(math.sqrt(soft_limit))\n                maxsize = int(math.sqrt(soft_limit))\n        else:\n            block = True\n            num_pools = int(math.sqrt(hard_limit))\n            maxsize = int(math.sqrt(hard_limit))\n\n        self.pool = self.init_pool_manager(\n            proxy=proxy,\n            ssl_context=ssl_config.ssl_context,\n            num_pools=num_pools,\n            maxsize=maxsize,\n            block=block,\n        )\n\n    def init_pool_manager(\n        self,\n        proxy: typing.Optional[Proxy],\n        ssl_context: ssl.SSLContext,\n        num_pools: int,\n        maxsize: int,\n        block: bool,\n    ) -> typing.Union[urllib3.PoolManager, urllib3.ProxyManager]:\n        if proxy is None:\n            return urllib3.PoolManager(\n                ssl_context=ssl_context,\n                num_pools=num_pools,\n                maxsize=maxsize,\n                block=block,\n            )\n        else:\n            return urllib3.ProxyManager(\n                proxy_url=str(proxy.url),\n                proxy_headers=dict(proxy.headers),\n                ssl_context=ssl_context,\n                num_pools=num_pools,\n                maxsize=maxsize,\n                block=block,\n            )\n\n    def send(self, request: Request, timeout: Timeout = None) -> Response:\n        timeout = Timeout() if timeout is None else timeout\n        urllib3_timeout = urllib3.util.Timeout(\n            connect=timeout.connect_timeout, read=timeout.read_timeout\n        )\n        chunked = request.headers.get(\"Transfer-Encoding\") == \"chunked\"\n        content_length = int(request.headers.get(\"Content-Length\", \"0\"))\n        body = request.stream if chunked or content_length else None\n\n        with as_network_error(MaxRetryError, SSLError, socket.error):\n            conn = self.pool.urlopen(\n                method=request.method,\n                url=str(request.url),\n                headers=dict(request.headers),\n                body=body,\n                redirect=False,\n                assert_same_host=False,\n                retries=0,\n                preload_content=False,\n                chunked=chunked,\n                timeout=urllib3_timeout,\n                pool_timeout=timeout.pool_timeout,\n            )\n\n        def response_bytes() -> typing.Iterator[bytes]:\n            with as_network_error(socket.error):\n                for chunk in conn.stream(4096, decode_content=False):\n                    yield chunk\n\n        return Response(\n            status_code=conn.status,\n            http_version=\"HTTP/1.1\",\n            headers=list(conn.headers.items()),\n            stream=IteratorStream(\n                iterator=response_bytes(), close_func=conn.release_conn\n            ),\n            request=request,\n        )\n\n    def close(self) -> None:\n        self.pool.clear()\n", "path": "httpx/dispatch/urllib3.py"}]}