@Test public void createATypedActor() { try { // #typed-actor-create1 Squarer mySquarer = TypedActor.get(system) .typedActorOf(new TypedProps<SquarerImpl>(Squarer.class, SquarerImpl.class)); // #typed-actor-create1 // #typed-actor-create2 Squarer otherSquarer = TypedActor.get(system) .typedActorOf( new TypedProps<SquarerImpl>( Squarer.class, new Creator<SquarerImpl>() { public SquarerImpl create() { return new SquarerImpl("foo"); } }), "name"); // #typed-actor-create2 // #typed-actor-calls // #typed-actor-call-oneway mySquarer.squareDontCare(10); // #typed-actor-call-oneway // #typed-actor-call-future Future<Integer> fSquare = mySquarer.square(10); // A Future[Int] // #typed-actor-call-future // #typed-actor-call-option Option<Integer> oSquare = mySquarer.squareNowPlease(10); // Option[Int] // #typed-actor-call-option // #typed-actor-call-strict int iSquare = mySquarer.squareNow(10); // Int // #typed-actor-call-strict // #typed-actor-calls assertEquals(100, Await.result(fSquare, Duration.create(3, TimeUnit.SECONDS)).intValue()); assertEquals(100, oSquare.get().intValue()); assertEquals(100, iSquare); // #typed-actor-stop TypedActor.get(system).stop(mySquarer); // #typed-actor-stop // #typed-actor-poisonpill TypedActor.get(system).poisonPill(otherSquarer); // #typed-actor-poisonpill } catch (Exception e) { // Ignore } }