The message length was the issue.
On sending i add 16 to the length so on receive I also subtract 16 from incoming length!
On your question above is that the server is not strictly ISO 8583.
1. It expects Header before length
2. length shoul be N6 so we zero-pad
3. the length is for the whole string including HEADER+LENGTH+DATA
But after tweeking the sendMessageLength and getMessageLength jPOS still worked wonders :D
The code is below:
protected void sendMessageLength(int len) throws IOException {
len += 16;
try {
System.out.println("SEND Message length: " + ISOUtil.zeropad(Integer.toString(len), 6));
} catch (ISOException ex) {
Logger.getLogger(BFUBChannel.class.getName()).log(Level.SEVERE, null, ex);
}
if (len > 9999)
throw new IOException ("len exceeded");
try {
serverOut.write("ISO8583-93".getBytes()); // beging of message field
serverOut.write(
ISOUtil.zeropad(Integer.toString(len), 6).getBytes()
);
} catch (ISOException e) { }
}
/**
* @return the Message len
* @exception IOException, ISOException
*/
protected int getMessageLength() throws IOException, ISOException {