code: def initiate_handshake(self, headers, timeout=None):
          
          io_loop = IOLoop.current()
          timeout = timeout or DEFAULT_INIT_TIMEOUT_SECS
  
          self.writer.put(messages.InitRequestMessage(
              version=PROTOCOL_VERSION,
              headers=headers
          ))
  
          init_res_future = self.reader.get()
          timeout_handle = io_loop.call_later(timeout, (
              lambda: init_res_future.set_exception(errors.TimeoutError(
                  'Handshake with %s:%d timed out. Did not receive an INIT_RES '
                  'after %s seconds' % (
                      self.remote_host, self.remote_host_port, str(timeout)
                  )
              ))
          ))
          io_loop.add_future(
              init_res_future,
              (lambda _: io_loop.remove_timeout(timeout_handle)),
          )
  
          init_res = yield init_res_future
          if init_res.message_type != Types.INIT_RES:
              raise errors.UnexpectedError(
                  "Expected handshake response, got %s" % repr(init_res)
              )
          self._extract_handshake_headers(init_res)
          self._handshake_performed = True
  
          # The receive loop is started only after the handshake has been
          # completed.
          self._loop()
  
          raise tornado.gen.Return(init_res)
docs: Initiate a handshake with the remote host.
  
          :param headers:
              A dictionary of headers to send.
          :returns:
              A future that resolves (with a value of None) when the handshake
              is complete.