Code example for EventHandler

0
        try { 
            SwingUtilities.invokeAndWait(
                    (Runnable) Proxy.newProxyInstance(
                            null, 
                            new Class[] {Runnable.class},
                            new EventHandler(
                                    Test6277266.class, 
                                    "getProtectionDomain", 
                                    null, 
                                    null 
                            ) 
                    ) 
            ); 
            throw new Error("SecurityException expected");
        } catch (InvocationTargetException exception) {
            if (exception.getCause() instanceof SecurityException){
                return; // expected security exception 
            } 
            throw new Error("unexpected exception", exception);
        } catch (InterruptedException exception) {