summaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.lang/TestProxy.java
diff options
context:
space:
mode:
authorAnthony Green <green@redhat.com>2002-09-30 05:19:09 +0000
committerAnthony Green <green@gcc.gnu.org>2002-09-30 05:19:09 +0000
commitd3cc3f10dac7b93c7b62d7e30b15f171fec3e8a5 (patch)
tree20a978bd321eb1dcc849c21ce9a31b82bad5ac75 /libjava/testsuite/libjava.lang/TestProxy.java
parentccf7aef4284066b77a1424df2d282be17d2b2083 (diff)
downloadgcc-d3cc3f10dac7b93c7b62d7e30b15f171fec3e8a5.tar.gz
Add Proxy support.
From-SVN: r57635
Diffstat (limited to 'libjava/testsuite/libjava.lang/TestProxy.java')
-rw-r--r--libjava/testsuite/libjava.lang/TestProxy.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/libjava/testsuite/libjava.lang/TestProxy.java b/libjava/testsuite/libjava.lang/TestProxy.java
new file mode 100644
index 00000000000..d1411a6f0a8
--- /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 ();
+ }
+ }
+}