@Test
  public void testWeld() throws Exception {
    TestWelder testWelder = new TestWelder();

    testWelder.state = BaseWelder.State.DESTROYED;

    try {
      testWelder.weld(null);

      Assert.fail();
    } catch (IllegalStateException ise) {
      Assert.assertEquals("Unable to weld a welder with state DESTROYED", ise.getMessage());
    }

    testWelder.state = BaseWelder.State.CREATED;

    RegistrationReference registrationReference = testWelder.weld(null);

    Assert.assertNull(testWelder._clientRegistrationReference);
    Assert.assertEquals(testWelder._serverRegistrationReference, registrationReference);
    Assert.assertEquals(BaseWelder.State.WELDED, testWelder.state);

    TestWelder newTestWelder = WelderTestUtil.transform(testWelder);

    registrationReference = newTestWelder.weld(null);

    Assert.assertEquals(newTestWelder._clientRegistrationReference, registrationReference);
    Assert.assertNull(newTestWelder._serverRegistrationReference);
    Assert.assertEquals(BaseWelder.State.WELDED, newTestWelder.state);
  }
  @Test
  public void testSerialization() throws Exception {
    TestWelder testWelder = new TestWelder();

    testWelder.registrationReference = new MockRegistrationReference(null);

    TestWelder newTestWelder = WelderTestUtil.transform(testWelder);

    Assert.assertNull(newTestWelder.registrationReference);
    Assert.assertFalse(newTestWelder.server);
    Assert.assertEquals(BaseWelder.State.CREATED, newTestWelder.state);
  }