/** * Creates a new, unauthenticated LDAP connection that is established to the * specified server. * * @param socketFactory The socket factory to use when establishing * connections. If it is {@code null}, then a * default socket factory will be used. * @param connectionOptions The set of connection options to use for this * connection. If it is {@code null}, then a * default set of options will be used. * @param host The string representation of the address of the * server to which the connection should be * established. It may be a resolvable name or an * IP address. It must not be {@code null}. * @param port The port number of the server to which the * connection should be established. It should be * a value between 1 and 65535, inclusive. * * @throws LDAPException If a problem occurs while attempting to connect to * the specified server. */ public LDAPConnection(final SocketFactory socketFactory, final LDAPConnectionOptions connectionOptions, final String host, final int port) throws LDAPException { this(socketFactory, connectionOptions); connect(host, port); }
/** * Creates a new, unauthenticated LDAP connection that is established to the * specified server. * * @param socketFactory The socket factory to use when establishing * connections. If it is {@code null}, then a * default socket factory will be used. * @param connectionOptions The set of connection options to use for this * connection. If it is {@code null}, then a * default set of options will be used. * @param host The string representation of the address of the * server to which the connection should be * established. It may be a resolvable name or an * IP address. It must not be {@code null}. * @param port The port number of the server to which the * connection should be established. It should be * a value between 1 and 65535, inclusive. * * @throws LDAPException If a problem occurs while attempting to connect to * the specified server. */ public LDAPConnection(final SocketFactory socketFactory, final LDAPConnectionOptions connectionOptions, final String host, final int port) throws LDAPException { this(socketFactory, connectionOptions); connect(host, port); }
throws LDAPException connect(inetAddress.getHostName(), inetAddress, port, timeout);
throws LDAPException connect(inetAddress.getHostName(), inetAddress, port, timeout);
/** * Establishes an unauthenticated connection to the directory server using the * provided information. If the connection is already established, then it * will be closed and re-established. * <BR><BR> * If this method is invoked while any operations are in progress on this * connection, then the directory server may or may not abort processing for * those operations, depending on the type of operation and how far along the * server has already gotten while processing that operation. It is * recommended that all active operations be abandoned, canceled, or allowed * to complete before attempting to re-establish an active connection. * * @param host The string representation of the address of the server to * which the connection should be established. It may be a * resolvable name or an IP address. It must not be * {@code null}. * @param port The port number of the server to which the connection should * be established. It should be a value between 1 and 65535, * inclusive. * * @throws LDAPException If an error occurs while attempting to establish * the connection. */ public void connect(final String host, final int port) throws LDAPException { connect(host, port, connectionOptions.getConnectTimeoutMillis()); }
connection.connect(address, port);
/** * Establishes an unauthenticated connection to the directory server using the * provided information. If the connection is already established, then it * will be closed and re-established. * <BR><BR> * If this method is invoked while any operations are in progress on this * connection, then the directory server may or may not abort processing for * those operations, depending on the type of operation and how far along the * server has already gotten while processing that operation. It is * recommended that all active operations be abandoned, canceled, or allowed * to complete before attempting to re-establish an active connection. * * @param host The string representation of the address of the server to * which the connection should be established. It may be a * resolvable name or an IP address. It must not be * {@code null}. * @param port The port number of the server to which the connection should * be established. It should be a value between 1 and 65535, * inclusive. * * @throws LDAPException If an error occurs while attempting to establish * the connection. */ @ThreadSafety(level=ThreadSafetyLevel.METHOD_NOT_THREADSAFE) public void connect(final String host, final int port) throws LDAPException { connect(host, port, connectionOptions.getConnectTimeoutMillis()); }
/** * fall back to connect using IP itself * @return */ private LDAPConnection tryGettingConnectionWithDirectIP() throws LDAPException { LDAPConnection ldapConnection = new LDAPConnection(); try{ hostIps.forEach( ip->{ try{ ldapConnection.connect(ip, ntPort,connectTimeout); throw new BreakLoopException(); }catch(LDAPException exception){ log.debug("unable to connect using" + ip + ", trying next ip"); } } ); }catch(BreakLoopException br){ log.info("got connected using IP"); } if(ldapConnection.isConnected()) return ldapConnection; else{ throw new LDAPException(ResultCode.CONNECT_ERROR,"unable to connect using IP"); } }
log.debug(String.format("trial number -> %s" , numberOfTries)); ldapConnection = new LDAPConnection(connectionOptions); ldapConnection.connect(ntDomain, ntPort,connectTimeout); break; }catch(LDAPException exception) {
final long startTime = System.currentTimeMillis(); try { connection.connect(hostname, port, timeout); break; } catch (final LDAPException e) {
conn.connect(ldapHost, ldapPort);
conn.connect(ldapHost, ldapPort);
connect(host, inetAddress, port, timeout);
connect(host, inetAddress, port, timeout);
try conn.connect(hostname, a, port, connectionOptions.getConnectTimeoutMillis()); if (healthCheck != null)
connect(reconnectAddress, reconnectPort);
connect(reconnectAddress, reconnectPort);
ldapConnection.connect( ldapConfiguration.getServer(), ldapConfiguration.getPort()); bindResult = ldapConnection.bind(
conn.connect(hostname, port);