Example #1
0
  @Test
  public void testSimpleInvokation()
      throws L2pSecurityException, CryptoException, AgentAlreadyRegisteredException, AgentException,
          SecurityException, IllegalArgumentException, AgentNotKnownException,
          NoSuchMethodException, IllegalAccessException, InvocationTargetException,
          InterruptedException {
    String serviceClass = "i5.las2peer.api.TestService";
    ServiceAgent testService = ServiceAgent.generateNewAgent(serviceClass, "a passphrase");
    testService.unlockPrivateKey("a passphrase");

    LocalNode testee = LocalNode.launchNode();

    eve.unlockPrivateKey("evespass");
    testee.storeAgent(eve);
    eve.lockPrivateKey();

    testee.storeAgent(testService);
    testee.registerReceiver(testService);

    Serializable result =
        testee.invokeLocally(
            eve.getId(), serviceClass, "inc", new Serializable[] {new Integer(10)});

    assertEquals(12, result);
  }