Retro68/gcc/libjava/testsuite/libjava.lang/TestProxy.java
Wolfgang Thaller aaf905ce07 add gcc 4.70
2012-03-28 01:13:14 +02:00

37 lines
774 B
Java

import java.lang.reflect.Proxy;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.net.*;
public class TestProxy
{
public static class MyInvocationHandler implements InvocationHandler
{
public Object invoke (Object proxy,
Method method,
Object[] args)
throws Throwable
{
System.out.println (args[0]);
return null;
}
}
public static void main (String[] args)
{
try {
InvocationHandler ih = new MyInvocationHandler();
SocketOptions c = (SocketOptions)
Proxy.newProxyInstance (SocketOptions.class.getClassLoader(),
new Class[]{SocketOptions.class},
ih);
c.getOption (555);
} catch (Exception e) {
e.printStackTrace ();
}
}
}