@Test
  public void demonstrateTheProgrammaticAPI() {
    // #programmatic
    ActorSystem system = ActorSystem.create("example");

    // Get the Serialization Extension
    Serialization serialization = SerializationExtension.get(system);

    // Have something to serialize
    String original = "woohoo";

    // Find the Serializer for it
    Serializer serializer = serialization.findSerializerFor(original);

    // Turn it into bytes
    byte[] bytes = serializer.toBinary(original);

    // Turn it back into an object,
    // the nulls are for the class manifest and for the classloader
    String back = (String) serializer.fromBinary(bytes);

    // Voilá!
    assertEquals(original, back);

    // #programmatic
    system.shutdown();
  }
 /**
  * Testing akka serialization
  *
  * @param system the system to test on
  * @param test the object to test
  */
 public static void testSerialization(ActorSystem system, Object test) throws Exception {
   // Get the Serialization Extension
   Serialization serialization = SerializationExtension.get(system);
   // Find the Serializer for it
   Serializer serializer = serialization.findSerializerFor(test);
   serializer.toBinary(test);
   serializer.fromBinary(serializer.toBinary(test));
 }