client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java
@Deprecated
  public synchronized OServerAdmin connect(final String iUserName, final String iUserPassword) throws IOException {
    final String username;
    final String password;

    OCredentialInterceptor ci = OSecurityManager.instance().newCredentialInterceptor();

    if (ci != null) {
      ci.intercept(storage.getURL(), iUserName, iUserPassword);
      username = ci.getUsername();
      password = ci.getPassword();
    } else {
      username = iUserName;
      password = iUserPassword;
    }
    OConnect37Request request = new OConnect37Request(username, password);

    networkAdminOperation((network, session) -> {
      OStorageRemoteNodeSession nodeSession = session.getOrCreateServerSession(network.getServerURL());
      try {
        network.beginRequest(request.getCommand(), session);
        request.write(network, session);
      } finally {
        network.endRequest();
      }
      OConnectResponse response = request.createResponse();
      try {
        network.beginResponse(nodeSession.getSessionId(), true);
        response.read(network, session);
      } finally {
        storage.endResponse(network);
      }
      return null;
    }, "Cannot connect to the remote server/database '" + storage.getURL() + "'");

    return this;
  }
@Deprecated
  public synchronized OServerAdmin connect(final String iUserName, final String iUserPassword) throws IOException {
    final String username;
    final String password;

    OCredentialInterceptor ci = OSecurityManager.instance().newCredentialInterceptor();

    if (ci != null) {
      ci.intercept(storage.getURL(), iUserName, iUserPassword);
      username = ci.getUsername();
      password = ci.getPassword();
    } else {
      username = iUserName;
      password = iUserPassword;
    }
    OConnect37Request request = new OConnect37Request(username, password);

    networkAdminOperation((network, session) -> {
      OStorageRemoteNodeSession nodeSession = session.getOrCreateServerSession(network.getServerURL());
      try {
        network.beginRequest(request.getCommand(), session);
        request.write(network, session);
      } finally {
        network.endRequest();
      }
      OConnectResponse response = request.createResponse();
      try {
        network.beginResponse(nodeSession.getSessionId(), true);
        response.read(network, session);
      } finally {
        storage.endResponse(network);
      }
      return null;
    }, "Cannot connect to the remote server/database '" + storage.getURL() + "'");

    return this;
  }
@ Deprecated public synchronized OServerAdmin connect ( final String iUserName , final String iUserPassword ) throws IOException { final String username ; final String password ; OCredentialInterceptor ci = OSecurityManager . instance ( ) . newCredentialInterceptor ( ) ; if ( ci != null ) { ci . intercept ( storage . getURL ( ) , iUserName , iUserPassword ) ; username = ci . getUsername ( ) ; password = ci . getPassword ( ) ; } else { username = iUserName ; password = iUserPassword ; } OConnect37Request request = new OConnect37Request ( username , password ) ; networkAdminOperation ( ( network , session ) -> { OStorageRemoteNodeSession nodeSession = session . getOrCreateServerSession ( network . getServerURL ( ) ) ; try { network . beginRequest ( request . getCommand ( ) , session ) ; request . write ( network , session ) ; } finally { network . endRequest ( ) ; } OConnectResponse response = request . createResponse ( ) ; try { network . beginResponse ( nodeSession . getSessionId ( ) , true ) ; response . read ( network , session ) ; } finally { storage . endResponse ( network ) ; } return null ; } , "Cannot connect to the remote server/database '" + storage . getURL ( ) + "'" ) ; return this ; }
Connects to a remote server.

@param iUserName     Server's user name
@param iUserPassword Server's password for the user name used

@return The instance itself. Useful to execute method in chain

@throws IOException
Connects to a remote server .