@Test public void serverSessionBindRejectedWithInvalidPassword() throws Exception { DefaultSmppServer server0 = createSmppServer(); server0.start(); try { DefaultSmppClient client0 = new DefaultSmppClient(); SmppSessionConfiguration sessionConfig0 = createDefaultConfiguration(); sessionConfig0.setSystemId(SYSTEMID); sessionConfig0.setPassword("BADPASS"); // this should fail (invalid password) try { SmppSession session0 = client0.bind(sessionConfig0); Assert.fail(); } catch (SmppBindException e) { Assert.assertEquals(SmppConstants.STATUS_INVPASWD, e.getBindResponse().getCommandStatus()); } Assert.assertEquals(0, serverHandler.sessions.size()); Assert.assertEquals(0, server0.getChannels().size()); } finally { server0.destroy(); } }
@Test public void serverSessionBindRejectedWithInvalidSystemId() throws Exception { DefaultSmppServer server0 = createSmppServer(); server0.start(); try { DefaultSmppClient client0 = new DefaultSmppClient(); SmppSessionConfiguration sessionConfig0 = createDefaultConfiguration(); sessionConfig0.setSystemId("TESTID"); // this should fail (invalid system id) try { SmppSession session0 = client0.bind(sessionConfig0); Assert.fail(); } catch (SmppBindException e) { Assert.assertEquals(SmppConstants.STATUS_INVSYSID, e.getBindResponse().getCommandStatus()); } // give this a little time to catch up Thread.sleep(100); Assert.assertEquals(0, serverHandler.sessions.size()); Assert.assertEquals(0, server0.getChannels().size()); } finally { server0.destroy(); } }