Search in sources :

Example 1 with CMPPEndpointEntity

use of com.zx.sms.connect.manager.cmpp.CMPPEndpointEntity in project SMSGate by Lihuanghe.

the class SessionLoginManager method doLogin.

@Override
protected void doLogin(Channel ch) {
    CMPPEndpointEntity cliententity = (CMPPEndpointEntity) entity;
    CmppConnectRequestMessage req = new CmppConnectRequestMessage();
    req.setSourceAddr(cliententity.getUserName());
    String timestamp = DateFormatUtils.format(CachedMillisecondClock.INS.now(), "MMddHHmmss");
    req.setTimestamp(Long.parseLong(timestamp));
    byte[] userBytes = cliententity.getUserName().getBytes(cliententity.getChartset());
    byte[] passwdBytes = cliententity.getPassword().getBytes(cliententity.getChartset());
    byte[] timestampBytes = timestamp.getBytes(cliententity.getChartset());
    req.setAuthenticatorSource(DigestUtils.md5(Bytes.concat(userBytes, new byte[9], passwdBytes, timestampBytes)));
    req.setVersion(cliententity.getVersion());
    ch.writeAndFlush(req);
    logger.info("session Start :Send CmppConnectRequestMessage seq :{}", req.getHeader().getSequenceId());
}
Also used : CMPPEndpointEntity(com.zx.sms.connect.manager.cmpp.CMPPEndpointEntity) CmppConnectRequestMessage(com.zx.sms.codec.cmpp.msg.CmppConnectRequestMessage)

Aggregations

CmppConnectRequestMessage (com.zx.sms.codec.cmpp.msg.CmppConnectRequestMessage)1 CMPPEndpointEntity (com.zx.sms.connect.manager.cmpp.CMPPEndpointEntity)1