From d3cc3f10dac7b93c7b62d7e30b15f171fec3e8a5 Mon Sep 17 00:00:00 2001 From: Anthony Green Date: Mon, 30 Sep 2002 05:19:09 +0000 Subject: Add Proxy support. From-SVN: r57635 --- libjava/testsuite/libjava.lang/TestProxy.java | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 libjava/testsuite/libjava.lang/TestProxy.java (limited to 'libjava/testsuite/libjava.lang/TestProxy.java') diff --git a/libjava/testsuite/libjava.lang/TestProxy.java b/libjava/testsuite/libjava.lang/TestProxy.java new file mode 100644 index 0000000..d1411a6 --- /dev/null +++ b/libjava/testsuite/libjava.lang/TestProxy.java @@ -0,0 +1,34 @@ +import java.lang.reflect.*; +import java.net.*; + +public class TestProxy +{ + public 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 (); + } + } +} -- cgit v1.1