public class Test {
public static void main(String args[]) throws ISOException
{
Logger logger = new Logger();
logger.addListener(new SimpleLogListener(System.out));
ISOMsg m = new ISOMsg();
MEPSISOHeader header = new MEPSISOHeader(ISOUtil.hex2byte("303030303030303030303030303030303030303030303030303030"));
//MEPSISOHeader header = new MEPSISOHeader();
System.out.println("ori: " + ISOUtil.dumpString(header.pack()));
header.setLiteral(MEPSISOHeader.LETERAL);
header.setProductIndicator(MEPSISOHeader.PROD_IND_MEPS_POS);
......
m.setHeader(header);
header.dump("");
m.setMTI("0800");
m.set(7, "xxxxxxxxxx");
. ......
MEPSChannel channel = new MEPSChannel("localhost", 7010, new ISO87APackager(), header);
((LogSource) channel).setLogger(logger, "channel");
try {
channel.connect();
channel.send(m);
ISOMsg incoming = channel.receive();
} catch (Exception e) {
System.out.println(e);
}
}
}
public class ServerTest implements ISORequestListener{
public static void main(String[] args)
{
ServerChannel sChannel = null;
Logger logger = new Logger();
logger.addListener(new SimpleLogListener(System.out));
try{
sChannel = new ASCIIChannel(new ISO87APackager());
((LogSource)sChannel).setLogger(logger,"server-channel-logger");
}catch(Exception e){
System.out.println(e);
}
ISOServer isoServer = new ISOServer(7010,sChannel,null); ISORequestListeners
isoServer.setLogger(logger,"server-logger");
isoServer.addISORequestListener(new ServerTest());
new Thread(isoServer).start(); // able to accept multiple connections at the same time
}
@Override
public boolean process(ISOSource isoSource, ISOMsg isoMsg) {
ISOMsg m = (ISOMsg) isoMsg.clone();
try {
m.setResponseMTI();
m.set(7,"xxxxxxxxxx");
......
isoSource.send(m);
} catch (ISOException e) {
} catch (IOException e) {
}
return true;
}
}
<log realm="server-channel-logger/127.0.0.1:43094" at="Thu Mar 30 17:14:53.995 MYT 2017" lifespan="505ms">
<receive>
<iso-exception>
Invalid message length
--To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/7439487f-fc51-4f18-b9c7-76266dfe8fc9%40googlegroups.com.
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.