private void sendMessages(){
  List<MurmurMessage> messages=getMessages(0);
  MurmurMessage exchangeInfoMessage=new MurmurMessage("ExchangeAgreement",Integer.toString(messages.size()),1d);
  if (lengthValueWrite(out,exchangeInfoMessage.toJSON(MurmurApplication.getContext(),0,0))) {
    for (    MurmurMessage message : messages) {
      List<MurmurMessage> packet=new ArrayList<>();
      packet.add(message);
      CleartextMessages messagesMessage=new CleartextMessages((ArrayList<MurmurMessage>)packet);
      lengthValueWrite(out,messagesMessage.toJson(MurmurApplication.getContext()));
    }
  }
}

private void sendMessages ( ) { List < MurmurMessage > messages = getMessages ( 0 ) ; MurmurMessage exchangeInfoMessage = new MurmurMessage ( "ExchangeAgreement" , Integer . toString ( messages . size ( ) ) , 1d ) ; if ( lengthValueWrite ( out , exchangeInfoMessage . toJSON ( MurmurApplication . getContext ( ) , 0 , 0 ) ) ) { for ( MurmurMessage message : messages ) { List < MurmurMessage > packet = new ArrayList < > ( ) ; packet . add ( message ) ; CleartextMessages messagesMessage = new CleartextMessages ( ( ArrayList < MurmurMessage > ) packet ) ; lengthValueWrite ( out , messagesMessage . toJson ( MurmurApplication . getContext ( ) ) ) ; } } }
get messages from the messagestore , encode them as a cleartextmessages protobuf object , and write that message out to the output stream .
