Repository: docker/docker-py
Issue: inspect image name with double slash

Using inspect image API like:

```
dc.inspect_image('192.168.220.3//aaabbb')
```

It will raise exception as following messages:

```
Traceback (most recent call last):
  File "dd.py", line 5, in <module>
    print dc.inspect_image('192.168.220.3//aaabbb')
  File "/home/vagrant/.local/share/virtualenvs/qnap/local/lib/python2.7/site-packages/docker/utils/decorators.py", line 15, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/home/vagrant/.local/share/virtualenvs/qnap/local/lib/python2.7/site-packages/docker/client.py", line 751, in inspect_image
    self._get(self._url("/images/{0}/json".format(image))),
  File "/home/vagrant/.local/share/virtualenvs/qnap/local/lib/python2.7/site-packages/docker/client.py", line 106, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/home/vagrant/.local/share/virtualenvs/qnap/local/lib/python2.7/site-packages/requests/sessions.py", line 477, in get
    return self.request('GET', url, **kwargs)
  File "/home/vagrant/.local/share/virtualenvs/qnap/local/lib/python2.7/site-packages/requests/sessions.py", line 465, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/vagrant/.local/share/virtualenvs/qnap/local/lib/python2.7/site-packages/requests/sessions.py", line 594, in send
    history = [resp for resp in gen] if allow_redirects else []
  File "/home/vagrant/.local/share/virtualenvs/qnap/local/lib/python2.7/site-packages/requests/sessions.py", line 196, in resolve_redirects
    **adapter_kwargs
  File "/home/vagrant/.local/share/virtualenvs/qnap/local/lib/python2.7/site-packages/requests/sessions.py", line 567, in send
    adapter = self.get_adapter(url=request.url)
  File "/home/vagrant/.local/share/virtualenvs/qnap/local/lib/python2.7/site-packages/requests/sessions.py", line 641, in get_adapter
    raise InvalidSchema("No connection adapters were found for '%s'" % url)
requests.exceptions.InvalidSchema: No connection adapters were found for '/v1.18/images/192.168.220.3/aaabbb/json'
```

But it works well when using docker cli `docker inspect 192.168.220.3//aaabbb`


Changed files:
docker/client.py, tests/integration_test.py

diff --git a/docker/client.py b/docker/client.py
index 0a932482..fdd4fc55 100644
--- a/docker/client.py
+++ b/docker/client.py
@@ -52,15 +52,16 @@ class Client(requests.Session):
 
         base_url = utils.parse_host(base_url)
         if base_url.startswith('http+unix://'):
-            unix_socket_adapter = unixconn.UnixAdapter(base_url, timeout)
-            self.mount('http+docker://', unix_socket_adapter)
+            self._adapter = unixconn.UnixAdapter(base_url, timeout)
+            self.mount('http+docker://', self._adapter)
             self.base_url = 'http+docker://localunixsocket'
         else:
             # Use SSLAdapter for the ability to specify SSL version
             if isinstance(tls, TLSConfig):
                 tls.configure_client(self)
             elif tls:
-                self.mount('https://', ssladapter.SSLAdapter())
+                self._adapter = ssladapter.SSLAdapter()
+                self.mount('https://', self._adapter)
             self.base_url = base_url
 
         # version detection needs to be after unix adapter mounting
@@ -243,6 +244,14 @@ class Client(requests.Session):
     def api_version(self):
         return self._version
 
+    def get_adapter(self, url):
+        try:
+            return super(Client, self).get_adapter(url)
+        except requests.exceptions.InvalidSchema as e:
+            if self._adapter:
+                return self._adapter
+            raise e
+
     @check_resource
     def attach(self, container, stdout=True, stderr=True,
                stream=False, logs=False):
diff --git a/tests/integration_test.py b/tests/integration_test.py
index 4b9869e2..ac4a8717 100644
--- a/tests/integration_test.py
+++ b/tests/integration_test.py
@@ -872,8 +872,8 @@ class TestRunContainerStreaming(BaseTestCase):
         id = container['Id']
         self.client.start(id)
         self.tmp_containers.append(id)
-        socket = self.client.attach_socket(container, ws=False)
-        self.assertTrue(socket.fileno() > -1)
+        sock = self.client.attach_socket(container, ws=False)
+        self.assertTrue(sock.fileno() > -1)
 
 
 class TestPauseUnpauseContainer(BaseTestCase):
@@ -1467,12 +1467,17 @@ class TestRegressions(BaseTestCase):
         result = self.client.containers(all=True, trunc=True)
         self.assertEqual(len(result[0]['Id']), 12)
 
+    def test_647(self):
+        with self.assertRaises(docker.errors.APIError):
+            self.client.inspect_image('gensokyo.jp//kirisame')
+
     def test_649(self):
         self.client.timeout = None
         ctnr = self.client.create_container('busybox', ['sleep', '2'])
         self.client.start(ctnr)
         self.client.stop(ctnr)
 
+
 if __name__ == '__main__':
     c = docker.Client(base_url=DEFAULT_BASE_URL)
     c.pull('busybox')