NotebookServer extends WebSocketServlet implements
        NotebookSocketListener, JobListenerFactory, AngularObjectRegistryListener { @Override public boolean checkOrigin(HttpServletRequest request, String origin) { try { return SecurityUtils.isValidOrigin(origin, ZeppelinConfiguration.create()); } catch (UnknownHostException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); } return false; }  @Override boolean checkOrigin(HttpServletRequest request, String origin); @Override WebSocket doWebSocketConnect(HttpServletRequest req, String protocol); @Override void onOpen(NotebookSocket conn); @Override void onMessage(NotebookSocket conn, String msg); @Override void onClose(NotebookSocket conn, int code, String reason); List<Map<String, String>> generateNotebooksInfo(boolean needsReload); void broadcastNote(Note note); void broadcastNoteList(); void broadcastReloadedNoteList(); @Override JobListener getParagraphJobListener(Note note); @Override void onAdd(String interpreterGroupId, AngularObject object); @Override void onUpdate(String interpreterGroupId, AngularObject object); @Override void onRemove(String interpreterGroupId, String name, String noteId);  }
@Test public void checkOrigin() throws UnknownHostException { NotebookServer server = new NotebookServer(); String origin = "http: assertTrue("Origin " + origin + " is not allowed. Please check your hostname.", server.checkOrigin(new TestHttpServletRequest(), origin)); }
@Test public void checkInvalidOrigin(){ NotebookServer server = new NotebookServer(); assertFalse(server.checkOrigin(new TestHttpServletRequest(), "http: }