package proxytest; import java.lang.reflect.Proxy; public class Main { public static void main(String args[]) { try { Class interfaces[] = { TokenInterface.class }; TokenInterface ti = (TokenInterface) Proxy.newProxyInstance( Main.class.getClassLoader(), interfaces, new TokenInvocationHandler(new Token())); System.out.println(ti.getVersion()); } catch (Exception e) { e.printStackTrace(); } } }