KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > ubik > rmi > server > RemoteRefReliableTest


1 package org.sapia.ubik.rmi.server;
2
3 import junit.framework.TestCase;
4
5 import org.sapia.ubik.net.TCPAddress;
6 import org.sapia.ubik.test.TestUtils;
7
8 import java.lang.reflect.Proxy JavaDoc;
9
10
11 /**
12  * @author Yanick Duchesne
13  * 15-Sep-2003
14  */

15 public class RemoteRefReliableTest extends TestCase {
16   /**
17    * Constructor for RemoteRefExTest.
18    * @param arg0
19    */

20   public RemoteRefReliableTest(String JavaDoc arg0) {
21     super(arg0);
22   }
23
24   public void testSerialize() throws Exception JavaDoc {
25     RemoteRefReliable ref = new RemoteRefReliable(new OID(0),
26         new TCPAddress("localhost", 0));
27     ref.setUp("ubik://somehost/someName");
28
29     Object JavaDoc proxy = Proxy.newProxyInstance(Thread.currentThread()
30                                                 .getContextClassLoader(),
31         TestUtils.getInterfacesFor(java.rmi.Remote JavaDoc.class), ref);
32     TestUtils.serialize(proxy);
33   }
34
35   public void testDeserialize() throws Exception JavaDoc {
36     RemoteRefReliable ref = new RemoteRefReliable(new OID(0),
37         new TCPAddress("localhost", 0));
38     ref.setUp("ubik://somehost/someName");
39
40     Object JavaDoc proxy = Proxy.newProxyInstance(Thread.currentThread()
41                                                 .getContextClassLoader(),
42         TestUtils.getInterfacesFor(java.rmi.Remote JavaDoc.class), ref);
43     byte[] b = TestUtils.serialize(proxy);
44     proxy = TestUtils.deserialize(b);
45   }
46 }
47
Popular Tags