@SuppressWarnings("restriction")
 @Override
 public void handle(WindowEvent event) {
   EventType<WindowEvent> eventType = event.getEventType();
   logger.debug("Window event: " + eventType.getName());
   websocketClientEndpoint.setReceiveTextArea(null);
   websocketClientEndpoint.close();
   try {
     Thread.sleep(500); // wait for websocket to close
   } catch (InterruptedException e) {
     logger.error("cant sleep", e);
   }
   client.shutdown();
   Platform.exit();
   System.exit(0);
 }
 @Override
 protected void performOnExit(WindowEvent event) {
   event.consume();
   handleClose();
 }