OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [TestProxy.java] - Blame information for rev 765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.