public DirectoryServiceTester(InetSocketAddress address) {

    _eventLoop = new EventLoop();
    _address = address;

    _eventLoop.start();

    // create server channel ...
    AsyncServerChannel channel = new AsyncServerChannel(this, _eventLoop, _address, this);

    // register RPC services it supports ...
    registerService(channel, DirectoryServiceCallback.spec);

    try {
      start();
    } catch (IOException e) {
      LOG.error(CCStringUtils.stringifyException(e));
      _eventLoop.stop();
      return;
    }

    _eventLoop.setTimer(
        new Timer(
            0,
            false,
            new Timer.Callback() {

              @Override
              public void timerFired(Timer timer) {
                connect();
              }
            }));
  }
  @Override
  public void OutgoingChannelConnected(AsyncClientChannel channel) {
    LOG.info("Connected to Directory Server. Initiating Registration");
    DirectoryServiceRegistrationInfo registrationInfo = new DirectoryServiceRegistrationInfo();

    _connectionCookie = System.currentTimeMillis();

    registrationInfo.setConnectionString(
        _address.getAddress().getHostAddress() + ":" + _address.getPort());
    registrationInfo.setRegistrationCookie(_connectionCookie);

    try {
      _serviceStub.register(
          registrationInfo,
          new AsyncRequest.Callback<DirectoryServiceRegistrationInfo, NullMessage>() {

            @Override
            public void requestComplete(
                AsyncRequest<DirectoryServiceRegistrationInfo, NullMessage> request) {}
          });
    } catch (IOException e) {
      LOG.error(CCStringUtils.stringifyException(e));
      _eventLoop.stop();
    }
  }
 @Override
 public void initialize(AsyncContext<DirectoryServiceRegistrationInfo, NullMessage> rpcContext)
     throws RPCException {
   LOG.info("Received Initialization Request on Callback Channel");
   if (rpcContext.getInput().getRegistrationCookie() == _connectionCookie) {
     LOG.info("Callback Cookie is Valid. Starting Test");
     rpcContext.setStatus(AsyncRequest.Status.Success);
     rpcContext.completeRequest();
     startTest();
   } else {
     LOG.error("Connection Cookies Don't Match!");
     _eventLoop.stop();
   }
 }