'Initialize an HTTP/HTTPS connection with chunked Transfer-Encoding
to server:port with optional headers.'

def _connect(self):

    server = self._server
    port = self._port
    headers = self._headers
    ssl_enabled = self._ssl_enabled
    (proxy_server, proxy_port) = self._get_proxy_config()
    if (proxy_server and proxy_port):
        if ssl_enabled:
            context = self._get_ssl_context()
            self._conn = http_client.HTTPSConnection(proxy_server, proxy_port, context=context)
        else:
            self._conn = http_client.HTTPConnection(proxy_server, proxy_port)
        self._conn.set_tunnel(server, port)
    elif ssl_enabled:
        context = self._get_ssl_context()
        self._conn = http_client.HTTPSConnection(server, port, context=context)
    else:
        self._conn = http_client.HTTPConnection(server, port)
    self._conn.putrequest('POST', self._url)
    self._conn.putheader('Transfer-Encoding', 'chunked')
    for header in headers:
        self._conn.putheader(header, headers[header])
    self._conn.endheaders()
    self._conn.sock.setblocking(False)
    self._bytes = six.b('')
    self._reset_retries()
    time.sleep(0.5)
