Search in sources :

Example 1 with RawChannel

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

the class BaseChannelTest method testGetOriginalRealm.

@Test
public void testGetOriginalRealm() throws Throwable {
    BaseChannel rawChannel = new RawChannel(new ISO87APackagerBBitmap(), "".getBytes());
    rawChannel.setLogger(null, "testBaseChannelRealm");
    String result = rawChannel.getOriginalRealm();
    assertEquals("testBaseChannelRealm", result, "result");
}
Also used : ISO87APackagerBBitmap(org.jpos.iso.packager.ISO87APackagerBBitmap) RawChannel(org.jpos.iso.channel.RawChannel) Test(org.junit.jupiter.api.Test)

Example 2 with RawChannel

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

the class BaseChannelTest method testGetDynamicHeader.

@Test
public void testGetDynamicHeader() throws Throwable {
    BaseChannel rawChannel = new RawChannel();
    byte[] image = new byte[2];
    BaseHeader result = (BaseHeader) rawChannel.getDynamicHeader(image);
    assertEquals(2, result.getLength(), "result.getLength()");
}
Also used : BaseHeader(org.jpos.iso.header.BaseHeader) RawChannel(org.jpos.iso.channel.RawChannel) Test(org.junit.jupiter.api.Test)

Example 3 with RawChannel

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

the class BaseChannelTest method testGetBytesThrowsNullPointerException.

@Test
public void testGetBytesThrowsNullPointerException() throws Throwable {
    BaseChannel rawChannel = new RawChannel(new ISO87APackagerBBitmap(), "".getBytes());
    byte[] b = new byte[1];
    try {
        rawChannel.getBytes(b);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        if (isJavaVersionAtMost(JAVA_14)) {
            assertNull(ex.getMessage(), "ex.getMessage()");
        } else {
            assertEquals("Cannot invoke \"java.io.DataInputStream.read(byte[])\" because \"this.serverIn\" is null", ex.getMessage(), "ex.getMessage()");
        }
        assertNull(((RawChannel) rawChannel).serverIn, "(RawChannel) rawChannel.serverIn");
    }
}
Also used : ISO87APackagerBBitmap(org.jpos.iso.packager.ISO87APackagerBBitmap) RawChannel(org.jpos.iso.channel.RawChannel) Test(org.junit.jupiter.api.Test)

Example 4 with RawChannel

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

the class BaseChannelTest method testGetSocket.

@Test
public void testGetSocket() throws Throwable {
    Socket result = new RawChannel().getSocket();
    assertNull(result, "result");
}
Also used : RawChannel(org.jpos.iso.channel.RawChannel) Test(org.junit.jupiter.api.Test)

Aggregations

RawChannel (org.jpos.iso.channel.RawChannel)4 Test (org.junit.jupiter.api.Test)4 ISO87APackagerBBitmap (org.jpos.iso.packager.ISO87APackagerBBitmap)2 BaseHeader (org.jpos.iso.header.BaseHeader)1