'Establishes a connection and starts an SSYNC request
with the object server.'

def connect(self):

    with exceptions.MessageTimeout(self.daemon.conn_timeout, 'connect    send'):
        self.connection = bufferedhttp.BufferedHTTPConnection(('%s:%s' % (self.node['replication_ip'], self.node['replication_port'])))
        self.connection.putrequest('SSYNC', ('/%s/%s' % (self.node['device'], self.job['partition'])))
        self.connection.putheader('Transfer-Encoding', 'chunked')
        self.connection.putheader('X-Backend-Storage-Policy-Index', int(self.job['policy']))
        frag_index = self.node.get('index', self.job.get('frag_index'))
        if (frag_index is None):
            frag_index = ''
        self.connection.putheader('X-Backend-Ssync-Frag-Index', frag_index)
        self.connection.putheader('X-Backend-Ssync-Node-Index', self.node.get('index', ''))
        self.connection.endheaders()
    with exceptions.MessageTimeout(self.daemon.node_timeout, 'connect    receive'):
        self.response = self.connection.getresponse()
        if (self.response.status != http.HTTP_OK):
            err_msg = self.response.read()[:1024]
            raise exceptions.ReplicationException(('Expected    status    %s;    got    %s    (%s)' % (http.HTTP_OK, self.response.status, err_msg)))
