/// <summary> /// This method retrieves the public key of the server and initiate the handshake back /// </summary> /// <param name="name">name of the client</param> private void GetServerPublicKeyAndInitiateHandshake(string name) { try { Model.QueueDeclarePassive(ClientQueue); } catch { throw new RabbitMQException(RabbitMQException.ExceptionType.NoClientQueue); } var data = Model.BasicGet(ClientQueue, true); if (data == null) { throw new RabbitMQException(RabbitMQException.ExceptionType.NoServerHandshakeData); } var handshake = BinaryFormatter <TServerHandshake> .FromBinary(data.Body); Chat = new EncryptedChat(name); Chat.Bind(handshake); SendClientPublicKeyToServer(handshake); }