// Test to connect to a portal

function contact_fn(actor,reason) {
  if (actor) {
    log.console(`Got an actor: ${json.encode(actor)}`)

    send(actor, {greet: "Hello!"}, e => {
      log.console(`Got the response ${json.encode(e)}. Goodbye!`);
      $_.stop()
    })
  }
  else
    log.console(`Did not get an actor: ${json.encode(reason)}`)
}

$_.contact(contact_fn,
{
  address: "localhost",
  port: 5678,
  password: "abc123"
});

/*$_.contact(contact_fn, {
  address: "localhost",
  port: 5678,
  password: "123abc"
})

$_.contact(contact_fn, {
  address: "localhost",
  port:1111,
})


*/
