@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(); } }
public SmppSessionConfiguration createDefaultConfiguration() { SmppSessionConfiguration configuration = new SmppSessionConfiguration(); configuration.setWindowSize(1); configuration.setName("Tester.Session.0"); configuration.setType(SmppBindType.TRANSCEIVER); configuration.setHost("localhost"); configuration.setPort(PORT); configuration.setConnectTimeout(100); configuration.setBindTimeout(100); configuration.setSystemId(SYSTEMID); configuration.setPassword(PASSWORD); configuration.getLoggingOptions().setLogBytes(true); return configuration; }