System.setIn(null);
AccessController.doPrivileged(new PrivilegedAction() { public Object run() { System.setIn(new EmptyInputStream()); return null; } });
    protected synchronized void stopDevice() throws DriverException {        final Device dev = getDevice();        dev.unregisterAPI(KeyboardAPI.class);        dev.unregisterAPI(SystemTriggerAPI.class);        KeyboardDaemon daemon = this.daemon;        if (System.in == kis) {            System.setIn(null);        }        if (eventQueueThread != null) {            eventQueueThread.stopProcessor();        }        this.eventQueueThread = null;        if (daemon != null) {            daemon.interrupt();        }        this.daemon = null;        try {            channel.close();        } catch (IOException ex) {            System.err.println("Error closing Keyboard channel: "                    + ex.toString());        }    }