code: public void setup() {
  
          LogActivator.logToFile(logger, this.getName(), Level.ALL);
  
          // Add the agent to the introspector and obtain the introspector
          // instance.
          introspector = JadeAgentIntrospector.getMyInstance(this);
          logger.fine("Agent " + this.getLocalName()
                  + " added to the Intrsopector");
  
          try {
              this.myMockConfiguration = (MockConfiguration) this.getArguments()[0];
          } catch (Exception e) {
              logger.warning("There was an error reading the BridgeMockAgent configuration.");
              logger.fine("The stack trace: \n" + e.getStackTrace());
              // TODO think about implement this exception or not.
              // throw new BadConfigurationException();
              throw new IllegalArgumentException(
                      "The mock agent didn't receive a configuration"
                              + " object. The first argument have to be a MockConfiguration object");
          }
  
          // Initialize the believes counts and the mailbox list. 
  //        introspector.storeBeliefValue(this, Definitions.RECEIVED_MESSAGE_COUNT, 0);
  //        introspector.storeBeliefValue(this, Definitions.SENDED_MESSAGE_COUNT, 0);
          this.mailbox = new ArrayList<ACLMessage>();
  
          // Attemps to register the aggent.
          boolean register = false;
          for (int i = 0; !register; i++) {
              try {
                  AgentRegistration.registerAgent(this,
                          myMockConfiguration.getDFservice(),
                          Definitions.BRIDGE_SERVICE_TYPE);
                  // TODO Service_Type could be a custom field of
                  // MockCondiguration.
                  register = true;
              } catch (FIPAException e) {
                  logger.warning("Exception while registering the RespositoryMockAgent");
              }
              if (i >= Definitions.REG_ATTEMPTS) {
                  break;
                  // TODO check if is necessary to implement this exception.
                  // throw new
                  // UnableToRegisterException(e.getStackTrace().toString());
              }
          }
  
          // Adds the behavior that listen for incoming messages.
          addBehaviour(new Listen(this));
      }
docs: Initializes the Agent.
  
  @see jade.core.Agent#setup()