Ejemplo de codificación y descodificación de un mensaje SPB.
package doxy.examples;
import java.io.IOException;
import com.dinamonetworks.Dinamo;
import br.com.trueaccess.TacException;
public class SPBEncodeDecode {
private static String strAddr = "127.0.0.1";
private static String strUsrId = "master";
private static String strPwd = "12345678";
private static int nPort = 4433;
public static void main(String[] args) throws TacException {
int nFlags = 0;
String szSrcISPB = "11111111@SPR";
byte bSpecialTreatment = 0;
boolean bAcceptExpiredCert = false;
boolean bAutoUpdateCert = false;
StringBuilder sb = new StringBuilder();
for(int i=0; i<1;i++)
{
sb.append("abcdefghijklmnopqrstuvwxyz");
}
byte[] pbMsgIn = sb.toString().getBytes();
Dinamo api = new Dinamo();
try {
api.openSession(strAddr, strUsrId, strPwd, nPort, nFlags);
byte[] bout = api.SPBEncode(szSrcISPB, szSrcISPB, pbMsgIn, bSpecialTreatment);
byte[] bin2 = api.SPBDecode(szSrcISPB, szSrcISPB, bout, bAcceptExpiredCert, bAutoUpdateCert);
} catch (TacException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally{
api.closeSession();
}
}
}