protected Connection tryMessagesToConnections(List<Message> messages,List<Connection> connections){
  for (int i=0, n=connections.size(); i < n; i++) {
    Connection con=connections.get(i);
    Message started=tryAllMessages(con,messages);
    if (started != null) {
      return con;
    }
  }
  return null;
}

protected Connection tryMessagesToConnections ( List < Message > messages , List < Connection > connections ) { for ( int i = 0 , n = connections . size ( ) ; i < n ; i ++ ) { Connection con = connections . get ( i ) ; Message started = tryAllMessages ( con , messages ) ; if ( started != null ) { return con ; } } return null ; }
tries to send all given messages to all given connections . connections are first iterated in the order they are in the list and for every connection , the messages are tried in the order they are in the list . once an accepting connection is found , no other connections or messages are tried .
