1 import java.lang.reflect.*;
2 import java.net.*;
3 
4 public class TestProxy
5 {
6   public class MyInvocationHandler implements InvocationHandler
7   {
invoke(Object proxy, Method method, Object[] args)8     public Object invoke (Object proxy,
9 			  Method method,
10 			  Object[] args)
11       throws Throwable
12     {
13       System.out.println (args[0]);
14       return null;
15     }
16   }
17 
main(String[] args)18   public static void main (String[] args)
19   {
20     try {
21       InvocationHandler ih = new MyInvocationHandler();
22 
23       SocketOptions c = (SocketOptions)
24 	Proxy.newProxyInstance (SocketOptions.class.getClassLoader(),
25 				new Class[]{SocketOptions.class},
26 				ih);
27 
28       c.getOption (555);
29 
30     } catch (Exception e) {
31       e.printStackTrace ();
32     }
33   }
34 }
35