'Create socket and connect to it, using SSL if enabled.
:returns: error string on failure; None on success'

def _create_and_connect_to_socket(self, sock_addr_tuple):

    self.socket = self._create_tcp_connection_socket(sock_addr_tuple[0], sock_addr_tuple[1], sock_addr_tuple[2])
    self.socket.setsockopt(SOL_TCP, socket.TCP_NODELAY, 1)
    self.socket.settimeout(self.params.socket_timeout)
    if self.params.ssl:
        self.socket = self._wrap_socket(self.socket)
        ssl_text = '    with    SSL'
    else:
        ssl_text = ''
    LOGGER.info('Connecting    to    %s:%s%s', sock_addr_tuple[4][0], sock_addr_tuple[4][1], ssl_text)
    try:
        self.socket.connect(sock_addr_tuple[4])
    except socket.timeout:
        error = ('Connection    to    %s:%s    failed:    timeout' % (sock_addr_tuple[4][0], sock_addr_tuple[4][1]))
        LOGGER.error(error)
        return error
    except _SOCKET_ERROR as error:
        error = ('Connection    to    %s:%s    failed:    %s' % (sock_addr_tuple[4][0], sock_addr_tuple[4][1], error))
        LOGGER.warning(error)
        return error
    if (self.params.ssl and self.DO_HANDSHAKE):
        try:
            self._do_ssl_handshake()
        except ssl.SSLError as error:
            error = ('SSL    connection    to    %s:%s    failed:    %s' % (sock_addr_tuple[4][0], sock_addr_tuple[4][1], error))
            LOGGER.error(error)
            return error
    return None
