private BaratineClient createHampClient(String address,
int port,
String userName,
String password)
{
Objects.requireNonNull(address);
String url = "http://" + address + ":" + port + "/hamp";
BaratineClient client = new BaratineClient(url, userName, password);
try {
return client;
} catch (ServiceExceptionConnect e) {
throw new ServiceExceptionConnect(L.l("Connection to '{0}' failed for remote administration.\n Ensure the local server has started, or include --server and --port parameters to connect to a remote server.\n {1}",
url, e.getMessage()), e);
} catch (ServiceExceptionUnavailable e) {
throw new ServiceExceptionUnavailable(L.l("Connection to '{0}' failed for remote administration because RemoteAdminService (HMTP) is not enabled.\n Ensure 'remote_admin_enable' is set true in resin.properties.\n {1}",
url, e.getMessage()), e);
}
}