SSL Error when request the https site: requests.exceptions.SSLError('SSL routines', 'ssl3_get_record', 'wrong version number')

Summary.
When I request the HTTPS site with proxy, **raise SSL Error sometimes**.
Yes it's **sometimes** throwing error. For example I  reqeust 50 times, 30 times of that will raise SSL Error.
I also tried remove **pyopenssl** lib and  it raise other Error too.
And it must be explained that I have a proxy pool,  it will get new proxy ip to request each 10s.

## Expected Result
Request https site normaly and return normal response.

## Actual Result
### Env1: Raise Exception (I already installed **pyopenssl**).
```
Traceback (most recent call last):
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/urllib3/contrib/pyopenssl.py", line 441, in wrap_socket
    cnx.do_handshake()
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/OpenSSL/SSL.py", line 1806, in do_handshake
    self._raise_ssl_error(self._ssl, result)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/OpenSSL/SSL.py", line 1546, in _raise_ssl_error
    _raise_current_error()
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue
    raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'ssl3_get_record', 'wrong version number')]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/urllib3/connectionpool.py", line 595, in urlopen
    self._prepare_proxy(conn)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/urllib3/connectionpool.py", line 816, in _prepare_proxy
    conn.connect()
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/urllib3/connection.py", line 326, in connect
    ssl_context=context)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/urllib3/util/ssl_.py", line 329, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/urllib3/contrib/pyopenssl.py", line 448, in wrap_socket
    raise ssl.SSLError('bad handshake: %r' % e)
ssl.SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_record', 'wrong version number')],)",)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='sp0.baidu.com', port=443): Max retries exceeded with url: xxxxxx (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_record', 'wrong version number')],)",),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test_run.py", line 68, in <module>
    timeout=6)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/requests/adapters.py", line 506, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='sp0.baidu.com', port=443): Max retries exceeded with url: xxxxxx  (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_record', 'wrong version number')],)",),))
```
### Env2: Raise Exception after removed **pyopenssl**.
```
Traceback (most recent call last):
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/urllib3/connectionpool.py", line 595, in urlopen
    self._prepare_proxy(conn)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/urllib3/connectionpool.py", line 816, in _prepare_proxy
    conn.connect()
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/urllib3/connection.py", line 326, in connect
    ssl_context=context)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/urllib3/util/ssl_.py", line 329, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.5/ssl.py", line 377, in wrap_socket
    _context=self)
  File "/usr/lib/python3.5/ssl.py", line 752, in __init__
    self.do_handshake()
  File "/usr/lib/python3.5/ssl.py", line 988, in do_handshake
    self._sslobj.do_handshake()
  File "/usr/lib/python3.5/ssl.py", line 633, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:645)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='sp0.baidu.com', port=443): Max retries exceeded with url: xxxxxx (Caused by SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:645)'),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test_run.py", line 67, in <module>
    response = requests.get(url=url, headers=headers, params=params, proxies={"https": get_proxy(CONN_REDIS)}, timeout=6)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/root/.virtualenvs/spider/lib/python3.5/site-packages/requests/adapters.py", line 506, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='sp0.baidu.com', port=443): Max retries exceeded with url: xxxxxx (Caused by SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:645)'),))
```

## Reproduction Steps

```python3
import requests
response = requests.get(url=url, headers=headers, params=params, 
                        proxies={"https": get_proxy(CONN_REDIS)}, timeout=6)
```

## System Information

```
System Version: ubuntu 16.04.4
Python Version: Python 3.5.2
```

    $ python -m requests.help

```
{
  "chardet": {
    "version": "3.0.4"
  },
  "cryptography": {
    "version": "2.1.4"
  },
  "idna": {
    "version": "2.6"
  },
  "implementation": {
    "name": "CPython",
    "version": "3.5.2"
  },
  "platform": {
    "release": "4.4.0-62-generic",
    "system": "Linux"
  },
  "pyOpenSSL": {
    "openssl_version": "1010007f",
    "version": "17.5.0"
  },
  "requests": {
    "version": "2.18.4"
  },
  "system_ssl": {
    "version": "1000207f"
  },
  "urllib3": {
    "version": "1.22"
  },
  "using_pyopenssl": true
}

```

According to the traceback, i just found this excepiton happend on the first handshake when run _prepare_proxy().
urllib3 1.22 source code is:
```
~/.virtualenv/virname/lib/python3.5/site-packages/urllib3/connectionpool.py 800~816
    def _prepare_proxy(self, conn):
        """
        Establish tunnel connection early, because otherwise httplib
        would improperly set Host: header to proxy's IP:port.
        """
        # Python 2.7+
        try:
            set_tunnel = conn.set_tunnel
        except AttributeError:  # Platform-specific: Python 2.6
            set_tunnel = conn._set_tunnel

        if sys.version_info <= (2, 6, 4) and not self.proxy_headers:  # Python 2.6.4 and older
            set_tunnel(self._proxy_host, self.port)
        else:
            set_tunnel(self._proxy_host, self.port, self.proxy_headers)

        conn.connect()
```
So I suspect it is proxy issue when  run _prepare_proxy(), but why it got successful respnose sometimes?
Thanks all!

Hi there @nickliqian 

Sorry for the delayed response. I think we lost track of this issue. In general, this is what we would call an ask for help, as there doesn't appear to be a defect in Requests. Instead, it seems like the TLS version that the proxies are sending in the handshake, sometimes, is not acceptable, supported, or just plain valid for your version of openssl. That's really it. In the future, questions are to be asked on [StackOverflow](https://stackoverflow.com) as this issue tracker is not a Q&A forum but a defect tracker.

Cheers,
Ian

@sigmavirus24 Get it, thanks your feedback! In the future I will ask on StackOverflow.