public static void main(String[] args) throws Throwable {
  Agent localAgent=createAgent(2020,true);
  localAgent.setNominationStrategy(NominationStrategy.NOMINATE_HIGHEST_PRIO);
  localAgent.addStateChangeListener(new IceProcessingListener());
  localAgent.setControlling(false);
  String localSDP=SdpUtils.createSDPDescription(localAgent);
  Thread.sleep(500);
  logger.info("=================== feed the following" + " to the remote agent ===================");
  logger.info("\n" + localSDP);
  logger.info("======================================" + "========================================\n");
  CandidatePrinter printer=new CandidatePrinter();
  printer.agent=localAgent;
  localAgent.startCandidateTrickle(printer);
  List<Component> allComponents=new LinkedList<>();
  int allCandidates=0;
  for (  IceMediaStream stream : localAgent.getStreams()) {
    for (    Component component : stream.getComponents()) {
      allComponents.add(component);
      allCandidates+=component.getLocalCandidateCount();
    }
  }
  logger.info("all candidates = " + allCandidates);
  Thread.sleep(60000);
}

public static void main ( String [ ] args ) throws Throwable { Agent localAgent = createAgent ( 2020 , true ) ; localAgent . setNominationStrategy ( NominationStrategy . NOMINATE_HIGHEST_PRIO ) ; localAgent . addStateChangeListener ( new IceProcessingListener ( ) ) ; localAgent . setControlling ( false ) ; String localSDP = SdpUtils . createSDPDescription ( localAgent ) ; Thread . sleep ( 500 ) ; logger . info ( "=================== feed the following" + " to the remote agent ===================" ) ; logger . info ( "\n" + localSDP ) ; logger . info ( "======================================" + "========================================\n" ) ; CandidatePrinter printer = new CandidatePrinter ( ) ; printer . agent = localAgent ; localAgent . startCandidateTrickle ( printer ) ; List < Component > allComponents = new LinkedList < > ( ) ; int allCandidates = 0 ; for ( IceMediaStream stream : localAgent . getStreams ( ) ) { for ( Component component : stream . getComponents ( ) ) { allComponents . add ( component ) ; allCandidates += component . getLocalCandidateCount ( ) ; } } logger . info ( "all candidates = " + allCandidates ) ; Thread . sleep ( 60000 ) ; }
runs a test application that allocates streams , generates an sdp , dumps it on stdout , waits for a remote peer sdp on stdin , then feeds that to our local agent and starts ice processing .
