code: protected final LDAPConnection connect() throws MojoExecutionException {
          final LDAPConnection connection = new LDAPConnection();
          int i = 0;
          while (i < connectionRetries) {
              long start = System.currentTimeMillis();
              try {
                  this.getLog().info("Attempting to connect ot LDAP directory server (" + host + ":" + port + ")");
                  connection.connect(host, port, connectionTimeout);
                  break;
              } catch (final LDAPException e) {
                  final String message = "Could not connect to LDAP directory server (" + host + ":" + port + ")";
                  this.getLog().error(message, e);
                  if (i++ < connectionRetries) {
                      long time = System.currentTimeMillis() - start;
                      if (time < connectionTimeout) {
                          try {
                              Thread.sleep(connectionTimeout - time);
                          } catch (final InterruptedException e1) {
                              throw new MojoExecutionException(message, e1);
                          }
                      }
                  } else {
                      throw new MojoExecutionException(message, e);
                  }
              }
          }
          try {
              connection.bind(authDn, passwd);
          } catch (final LDAPException e) {
              throw new MojoExecutionException("Could not bind to LDAP directory server as " + authDn, e);
          }
          return connection;
      }
docs: Connect to the LDAP directory server. The connection attempt will be retried {@link #connectionRetries} times
  and the connection time is set to {@link #connectionTimeout}.
  
  @return The connection object.
  @throws MojoExecutionException If the connection to the LDAP directory server failed.