public SecureShellAgent(final String host,final int port,final String user,final Path privateKeyFileAbsolutePath) throws AgentException {
  try {
    session=getSession(host,port,user);
    jsch.addIdentity(privateKeyFileAbsolutePath.toString());
  }
 catch (  Exception e) {
    String errorMessage=format("Can't connect to host '%s@%s:%s' by using private key '%s'.",user,host,port,privateKeyFileAbsolutePath);
    throw create(errorMessage,e);
  }
}

public SecureShellAgent ( final String host , final int port , final String user , final Path privateKeyFileAbsolutePath ) throws AgentException { try { session = getSession ( host , port , user ) ; jsch . addIdentity ( privateKeyFileAbsolutePath . toString ( ) ) ; } catch ( Exception e ) { String errorMessage = format ( "Can't connect to host '%s@%s:%s' by using private key '%s'." , user , host , port , privateKeyFileAbsolutePath ) ; throw create ( errorMessage , e ) ; } }
create ssh session object and try to connect to remote host by using auth key .
