'Verify we can connect to novnc and do the websocket connection.'

def _validate_rfb_negotiation(self):

    data = self._websocket.receive_frame()
    self.assertFalse(((data is None) or (not data)), 'Token    must    be    invalid    because    the    connection    closed.')
    version = float(('%d.%d' % (int(data[4:7], base=10), int(data[8:11], base=10))))
    supported_versions = [3.3, 3.8]
    self.assertIn(version, supported_versions, ('Bad    RFB    Version:    ' + str(version)))
    self._websocket.send_frame(data)
    data = self._websocket.receive_frame()
    self.assertIsNotNone(data, 'Expected    authentication    type    None.')
    data_length = len(data)
    if (version == 3.3):
        self.assertEqual(data_length, 4, 'Expected    authentication    type    None.')
        self.assertIn(1, [ord_func(data[i]) for i in (0, 3)], 'Expected    authentication    type    None.')
    else:
        self.assertGreaterEqual(len(data), 2, 'Expected    authentication    type    None.')
        self.assertIn(1, [ord_func(data[(i + 1)]) for i in range(ord_func(data[0]))], 'Expected    authentication    type    None.')
        self._websocket.send_frame(six.int2byte(1))
        data = self._websocket.receive_frame()
        self.assertEqual(len(data), 4, 'Server    did    not    think    security    was    successful.')
        self.assertEqual([ord_func(i) for i in data], [0, 0, 0, 0], 'Server    did    not    think    security    was    successful.')
    self._websocket.send_frame(six.int2byte(1))
    data = self._websocket.receive_frame()
    data_length = (len(data) if (data is not None) else 0)
    self.assertFalse(((data_length <= 24) or (data_length != (struct.unpack('>L', data[20:24])[0] + 24))), 'Server    initialization    was    not    the    right    format.')
    self.assertFalse(((data_length <= 24) or (data_length != (struct.unpack('>L', data[20:24])[0] + 24))))
