KickJava   Java API By Example, From Geeks To Geeks.

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


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 RemoteRefExTest extends TestCase {
16   /**
17    * Constructor for RemoteRefExTest.
18    * @param arg0
19    */

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