PDUComposer composer = new DefaultComposer();
PDUDecomposer decomposer = new DefaultDecomposer();
byte[] b = null;
String systemId = "smsc";
BindType bindType = BindType.BIND_TRX;
try {
b = composer.bindResp(bindType.responseCommandId(), 1, systemId);
assertEquals(b.length, 16 + systemId.length() + 1);
printLog("Length of bytes : " + b.length);
} catch (PDUStringException e) {
fail("Failed composing bind response", e);
}
try {
BindResp resp = decomposer.bindResp(b);
assertEquals(resp.getCommandLength(), b.length);
assertEquals(resp.getCommandId(), bindType.responseCommandId());
assertEquals(resp.getCommandStatus(), SMPPConstant.STAT_ESME_ROK);
assertEquals(resp.getSequenceNumber(), 1);
assertEquals(resp.getSystemId(), systemId);
} catch (PDUStringException e) {
fail("Failed decomposing bind response", e);