use of org.jpos.iso.ISOPackager in project jPOS by jpos.
the class HEXChannelTest method testConstructor3.
@Test
public void testConstructor3() throws Throwable {
ISOPackager p = new ISOBaseValidatingPackager();
byte[] TPDU = new byte[2];
ServerSocket serverSocket = new ServerSocket();
HEXChannel hEXChannel = new HEXChannel(p, TPDU, serverSocket);
assertEquals(0, hEXChannel.getIncomingFilters().size(), "hEXChannel.getIncomingFilters().size()");
assertEquals(100000, hEXChannel.getMaxPacketLength(), "hEXChannel.getMaxPacketLength()");
assertSame(p, hEXChannel.getPackager(), "hEXChannel.getPackager()");
assertEquals(0, hEXChannel.getPort(), "hEXChannel.getPort()");
assertEquals("", hEXChannel.getName(), "hEXChannel.getName()");
assertEquals(3, hEXChannel.getCounters().length, "hEXChannel.getCounters().length");
assertNull(hEXChannel.getLogger(), "hEXChannel.getLogger()");
assertNull(hEXChannel.getSocketFactory(), "hEXChannel.getSocketFactory()");
assertSame(TPDU, hEXChannel.getHeader(), "hEXChannel.getHeader()");
assertEquals(0, hEXChannel.getOutgoingFilters().size(), "hEXChannel.getOutgoingFilters().size()");
assertSame(serverSocket, hEXChannel.getServerSocket(), "hEXChannel.getServerSocket()");
assertEquals("org.jpos.iso.channel.HEXChannel", hEXChannel.getOriginalRealm(), "hEXChannel.getOriginalRealm()");
assertNull(hEXChannel.getRealm(), "hEXChannel.getRealm()");
assertNull(hEXChannel.getHost(), "hEXChannel.getHost()");
}
use of org.jpos.iso.ISOPackager in project jPOS by jpos.
the class NativePackager method pack.
@Override
public byte[] pack(ISOComponent c) throws ISOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
if (c instanceof ISOMsg) {
ISOMsg m = (ISOMsg) c;
ISOPackager p = m.getPackager();
m.setPackager(null);
ObjectOutputStream os = new ObjectOutputStream(baos);
((Externalizable) c).writeExternal(os);
os.flush();
m.setPackager(p);
}
} catch (IOException e) {
throw new ISOException(e);
}
return baos.toByteArray();
}
use of org.jpos.iso.ISOPackager in project jPOS by jpos.
the class PADChannelTest method testConstructor1.
@Test
public void testConstructor1() throws Throwable {
ISOPackager p = new ISO93BPackager();
ServerSocket serverSocket = new ServerSocket();
PADChannel pADChannel = new PADChannel(p, serverSocket);
assertEquals(0, pADChannel.getIncomingFilters().size(), "pADChannel.getIncomingFilters().size()");
assertEquals(100000, pADChannel.getMaxPacketLength(), "pADChannel.getMaxPacketLength()");
assertSame(p, pADChannel.getPackager(), "pADChannel.getPackager()");
assertEquals(0, pADChannel.getPort(), "pADChannel.getPort()");
assertEquals("", pADChannel.getName(), "pADChannel.getName()");
assertEquals(3, pADChannel.getCounters().length, "pADChannel.getCounters().length");
assertNull(pADChannel.getLogger(), "pADChannel.getLogger()");
assertNull(pADChannel.getSocketFactory(), "pADChannel.getSocketFactory()");
assertNull(pADChannel.getHeader(), "pADChannel.getHeader()");
assertEquals(0, pADChannel.getOutgoingFilters().size(), "pADChannel.getOutgoingFilters().size()");
assertSame(serverSocket, pADChannel.getServerSocket(), "pADChannel.getServerSocket()");
assertEquals("org.jpos.iso.channel.PADChannel", pADChannel.getOriginalRealm(), "pADChannel.getOriginalRealm()");
assertNull(pADChannel.getRealm(), "pADChannel.getRealm()");
assertNull(pADChannel.getHost(), "pADChannel.getHost()");
assertNull(pADChannel.reader, "pADChannel.reader");
}
use of org.jpos.iso.ISOPackager in project jPOS by jpos.
the class PADChannelTest method testConstructor.
@Test
public void testConstructor() throws Throwable {
ISOPackager p = new ISOBaseValidatingPackager();
PADChannel pADChannel = new PADChannel("testPADChannelHost", 100, p);
assertEquals(0, pADChannel.getIncomingFilters().size(), "pADChannel.getIncomingFilters().size()");
assertEquals(100000, pADChannel.getMaxPacketLength(), "pADChannel.getMaxPacketLength()");
assertSame(p, pADChannel.getPackager(), "pADChannel.getPackager()");
assertEquals(100, pADChannel.getPort(), "pADChannel.getPort()");
assertEquals("", pADChannel.getName(), "pADChannel.getName()");
assertEquals(3, pADChannel.getCounters().length, "pADChannel.getCounters().length");
assertNull(pADChannel.getLogger(), "pADChannel.getLogger()");
assertNull(pADChannel.getSocketFactory(), "pADChannel.getSocketFactory()");
assertNull(pADChannel.getHeader(), "pADChannel.getHeader()");
assertEquals(0, pADChannel.getOutgoingFilters().size(), "pADChannel.getOutgoingFilters().size()");
assertNull(pADChannel.getServerSocket(), "pADChannel.getServerSocket()");
assertEquals("org.jpos.iso.channel.PADChannel", pADChannel.getOriginalRealm(), "pADChannel.getOriginalRealm()");
assertNull(pADChannel.getRealm(), "pADChannel.getRealm()");
assertEquals("testPADChannelHost", pADChannel.getHost(), "pADChannel.getHost()");
assertNull(pADChannel.reader, "pADChannel.reader");
}
use of org.jpos.iso.ISOPackager in project jPOS by jpos.
the class RawChannelTest method testConstructor2.
@Test
public void testConstructor2() throws Throwable {
byte[] header = new byte[0];
ISOPackager p = new BASE24Packager();
RawChannel rawChannel = new RawChannel(p, header);
assertEquals(0, rawChannel.getIncomingFilters().size(), "rawChannel.getIncomingFilters().size()");
assertEquals(100000, rawChannel.getMaxPacketLength(), "rawChannel.getMaxPacketLength()");
assertSame(p, rawChannel.getPackager(), "rawChannel.getPackager()");
assertEquals(0, rawChannel.getPort(), "rawChannel.getPort()");
assertEquals("", rawChannel.getName(), "rawChannel.getName()");
assertEquals(3, rawChannel.getCounters().length, "rawChannel.getCounters().length");
assertNull(rawChannel.getLogger(), "rawChannel.getLogger()");
assertNull(rawChannel.getSocketFactory(), "rawChannel.getSocketFactory()");
assertSame(header, rawChannel.getHeader(), "rawChannel.getHeader()");
assertEquals(0, rawChannel.getOutgoingFilters().size(), "rawChannel.getOutgoingFilters().size()");
assertNull(rawChannel.getServerSocket(), "rawChannel.getServerSocket()");
assertEquals("org.jpos.iso.channel.RawChannel", rawChannel.getOriginalRealm(), "rawChannel.getOriginalRealm()");
assertNull(rawChannel.getRealm(), "rawChannel.getRealm()");
assertNull(rawChannel.getHost(), "rawChannel.getHost()");
}
Aggregations