Last change
on this file was 1389, checked in by bird, 21 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
File size:
686 bytes
|
Line | |
---|
1 | import java.lang.reflect.*;
|
---|
2 | import java.net.*;
|
---|
3 |
|
---|
4 | public class TestProxy
|
---|
5 | {
|
---|
6 | public class MyInvocationHandler implements InvocationHandler
|
---|
7 | {
|
---|
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 |
|
---|
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 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.