@Test public void testSyncAuthFailed() throws Exception { startServer(); authenticator = new PasswordAuthenticator() { @Override public boolean authenticate(String username, String password, ServerSession session) throws PasswordChangeRequiredException { return false; } }; assertFalse(authenticate()); }
@Test public void testSyncAuthFailed() throws Exception { startServer(); authenticator = (username, password, sess) -> false; assertFalse(authenticate()); }
@Test public void testSyncAuthFailed() throws Exception { startServer(); authenticator = (username, password, sess) -> false; assertFalse(authenticate()); }
@Test public void testAsyncAuthFailed() throws Exception { startServer(); authenticator = new PasswordAuthenticator() { @Override public boolean authenticate(String username, String password, ServerSession session) throws PasswordChangeRequiredException { final AsyncAuth auth = new AsyncAuth(); new Thread() { @Override public void run() { try { Thread.sleep(200); } catch (InterruptedException ignore) { } finally { auth.setAuthed(false); } } }.start(); throw auth; } }; assertFalse(authenticate()); }
@Test public void testAsyncAuthFailed() throws Exception { startServer(); authenticator = (username, password, sess) -> { AsyncAuth auth = new AsyncAuth(); new Thread() { @Override public void run() { try { Thread.sleep(200); } catch (InterruptedException ignore) { } finally { auth.setAuthed(false); } } }.start(); throw auth; }; assertFalse(authenticate()); }
@Test public void testAsyncAuthFailed() throws Exception { startServer(); authenticator = (username, password, sess) -> { AsyncAuth auth = new AsyncAuth(); new Thread() { @Override public void run() { try { Thread.sleep(200); } catch (InterruptedException ignore) { } finally { auth.setAuthed(false); } } }.start(); throw auth; }; assertFalse(authenticate()); }