@Override
 public void release() {
   for (AbstractBenchmarkClient bc : activeClients.values()) {
     bc.release();
   }
   super.release();
 }
  @Override
  protected void createHandlerChain() {
    super.createHandlerChain();

    getConnector()
        .addHandler(
            new DefaultCommandHandler() {
              @Override
              public boolean handleCommand(BenchmarkCommand command) {
                switch (command.getCommandType()) {
                  case CommandTypes.GET_CLIENT_INFO:
                    {
                      sendCommand(getClientInfo());
                      return true;
                    }
                  case CommandTypes.PREPARE_BENCHMARK:
                    PrepareBenchmarkCommand prepCommand = (PrepareBenchmarkCommand) command;
                    log()
                        .debug(
                            "Handling Benchmark prepare command ..."
                                + prepCommand.getBenchmarkConfig().getBenchmarkId());

                    AbstractBenchmarkClient bc = null;

                    for (BenchmarkPartConfig partConfig :
                        prepCommand.getBenchmarkConfig().getBenchmarkParts()) {
                      if (partConfig.isAcceptAllConsumers()
                          || matchesClient(partConfig.getConsumerClients())) {
                        bc = addClients(ClientType.CONSUMER, partConfig);
                        if (bc != null) {
                          PrepareBenchmarkResponse response = new PrepareBenchmarkResponse(bc);
                          getCmdTransport().sendCommand(response);
                        }
                      }
                      if (partConfig.isAcceptAllProducers()
                          || matchesClient(partConfig.getProducerClients())) {
                        bc = addClients(ClientType.PRODUCER, partConfig);
                        if (bc != null) {
                          PrepareBenchmarkResponse response = new PrepareBenchmarkResponse(bc);
                          getCmdTransport().sendCommand(response);
                        }
                      }
                    }
                    bc = addProbeRunner(prepCommand.getBenchmarkConfig());
                    if (bc != null) {
                      PrepareBenchmarkResponse response = new PrepareBenchmarkResponse(bc);
                      getCmdTransport().sendCommand(response);
                    }
                    return true;
                  case CommandTypes.START_BENCHMARK:
                    StartBenchmarkCommand startCommand = (StartBenchmarkCommand) command;
                    log()
                        .debug(
                            "Handling Benchmark start command ..." + startCommand.getBenchmarkId());
                    startBenchmark(startCommand);
                    return true;
                  case CommandTypes.END_BENCHMARK:
                    EndBenchmarkCommand endCommand = (EndBenchmarkCommand) command;
                    log().debug("Handling Benchmark end command ..." + endCommand.getBenchmarkId());
                    endBenchmark(endCommand);
                    return true;
                  default:
                    return false;
                }
              }
            });
  }