How can I log into bonita engine from external java application with APIClient?

I have a program in a different server but i need to acces some of the API-s of the bonita engine. How can i do that?

I already tried:

parameters.put("server.url", "http://URL:PORT");
parameters.put("application.name", "bonita");
APITypeManager.setAPITypeAndParams(ApiAccessType.HTTP, parameters);

org.bonitasoft.engine.api.APIClient apiClient = new APIClient();
apiClient.login("user", "password");

But I always get some error like: