@Test
 public void testSecureMethod() throws Throwable {
   Method secureMethod = object.getClass().getDeclaredMethod(secureMethodName, new Class[] {});
   try {
     proxy.invoke(proxy, secureMethod, new Object[] {});
     fail("expected PermissionException");
   } catch (PermissionException expected) {
     assertFalse(secureMethodCalled);
   }
 }
 @Test
 public void testInsecureMethod() throws Throwable {
   Method insecureMethod = object.getClass().getDeclaredMethod(insecureMethodName, new Class[] {});
   proxy.invoke(proxy, insecureMethod, new Object[] {});
   assertTrue(insecureMethodCalled);
 }