public void handleMessage(BSPMessage message)
        {
            RepositoryStateSerializer serializer    = new RepositoryStateSerializer();
            RepositoryState           incomingState = serializer.deserialize(message.getData());

            if (incomingState.RevisionNumber() > remoteState.RevisionNumber())
            {
                this.remoteState = incomingState;
                IEnumerable <CachedBelief> changedBeliefs = repo.Diff(remoteState);
                foreach (CachedBelief belief in changedBeliefs)
                {
                    protocol.post(belief);
                }
            }
        }
        public void synchronizeAllBeliefs()
        {
            if (protocol.getConnection().getRemoteAddress() == null)
            {
                return;
            }

            RepositoryStateSerializer serializer = new RepositoryStateSerializer();
            NetworkBuffer             buffer     = serializer.serialize(repo.CurrentState());
            BSPMessage message = new BSPMessage(protocol.getConnection().getRemoteAddress(),
                                                BSPMessageType.SYNC,
                                                protocol.getAgentID(),
                                                buffer);

            protocol.getConnection().send(message);
        }