@Override public synchronized void start(){
  if (running) {
    return;
  }
  LOGGER.info("Starting server");
  if (endpoints.isEmpty()) {
    int port=config.getInt(NetworkConfig.Keys.COAP_PORT);
    LOGGER.log(Level.INFO,"No endpoints have been defined for server, setting up server endpoint on default port {0}",port);
    addEndpoint(new CoapEndpoint(port,this.config));
  }
  int started=0;
  for (  Endpoint ep : endpoints) {
    try {
      ep.start();
      ++started;
    }
 catch (    IOException e) {
      LOGGER.log(Level.SEVERE,"Cannot start server endpoint [" + ep.getAddress() + "]",e);
    }
  }
  if (started == 0) {
    throw new IllegalStateException("None of the server endpoints could be started");
  }
 else {
    running=true;
  }
}

@ Override public synchronized void start ( ) { if ( running ) { return ; } LOGGER . info ( "Starting server" ) ; if ( endpoints . isEmpty ( ) ) { int port = config . getInt ( NetworkConfig . Keys . COAP_PORT ) ; LOGGER . log ( Level . INFO , "No endpoints have been defined for server, setting up server endpoint on default port {0}" , port ) ; addEndpoint ( new CoapEndpoint ( port , this . config ) ) ; } int started = 0 ; for ( Endpoint ep : endpoints ) { try { ep . start ( ) ; ++ started ; } catch ( IOException e ) { LOGGER . log ( Level . SEVERE , "Cannot start server endpoint [" + ep . getAddress ( ) + "]" , e ) ; } } if ( started == 0 ) { throw new IllegalStateException ( "None of the server endpoints could be started" ) ; } else { running = true ; } }
starts the server by starting all endpoints this server is assigned to . each endpoint binds to its port . if no endpoint is assigned to the server , an endpoint is started on the port defined in the config .
