Search in sources :

Example 1 with HEXChannel

use of org.jpos.iso.channel.HEXChannel in project jPOS by jpos.

the class BaseChannelTest method testGetHeaderLength.

@Test
public void testGetHeaderLength() throws Throwable {
    BaseChannel hEXChannel = new HEXChannel(new ISO87APackagerBBitmap(), "".getBytes(), new ServerSocket());
    byte[] b = new byte[3];
    int result = hEXChannel.getHeaderLength(b);
    assertEquals("result", 0, result);
}
Also used : HEXChannel(org.jpos.iso.channel.HEXChannel) ISO87APackagerBBitmap(org.jpos.iso.packager.ISO87APackagerBBitmap) Test(org.junit.Test)

Example 2 with HEXChannel

use of org.jpos.iso.channel.HEXChannel in project jPOS by jpos.

the class BaseChannelTest method testSetIncomingFiltersThrowsNullPointerException.

@Test
public void testSetIncomingFiltersThrowsNullPointerException() throws Throwable {
    byte[] TPDU = new byte[0];
    BaseChannel hEXChannel = new HEXChannel("testBaseChannelHost", 100, new GenericPackager(), TPDU);
    try {
        hEXChannel.setIncomingFilters(null);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
        assertEquals("(HEXChannel) hEXChannel.incomingFilters.size()", 0, ((HEXChannel) hEXChannel).incomingFilters.size());
    }
}
Also used : GenericPackager(org.jpos.iso.packager.GenericPackager) HEXChannel(org.jpos.iso.channel.HEXChannel) Test(org.junit.Test)

Example 3 with HEXChannel

use of org.jpos.iso.channel.HEXChannel in project jPOS by jpos.

the class BaseChannelTest method testNewSocketThrowsIllegalArgumentException.

@Test
public void testNewSocketThrowsIllegalArgumentException() throws Throwable {
    byte[] TPDU = new byte[0];
    BaseChannel hEXChannel = new HEXChannel("testBaseChannelHost", -1, new GenericPackager(), TPDU);
    try {
        hEXChannel.newSocket("test", -1);
        fail("Expected IllegalArgumentException to be thrown");
    } catch (IllegalArgumentException ex) {
        assertEquals("ex.getMessage()", "port out of range:-1", ex.getMessage());
        assertNull("(HEXChannel) hEXChannel.socketFactory", ((HEXChannel) hEXChannel).socketFactory);
    }
}
Also used : GenericPackager(org.jpos.iso.packager.GenericPackager) HEXChannel(org.jpos.iso.channel.HEXChannel) Test(org.junit.Test)

Aggregations

HEXChannel (org.jpos.iso.channel.HEXChannel)3 Test (org.junit.Test)3 GenericPackager (org.jpos.iso.packager.GenericPackager)2 ISO87APackagerBBitmap (org.jpos.iso.packager.ISO87APackagerBBitmap)1