Package org.jpos.iso.channel

Examples of org.jpos.iso.channel.XMLChannel


    }

    @Test
    public void testProcess() throws Throwable {
        Connector connector = new Connector();
        boolean result = connector.process(new XMLChannel(), new ISOMsg(100));
        assertTrue("result", result);
    }
View Full Code Here


        assertTrue("result", result);
    }

    @Test
    public void testProcessConstructor() throws Throwable {
        ISOSource source = new XMLChannel(new EuroPackager(), new ServerSocket());
        ISOMsg m = new ISOMsg(100);
        Connector.Process process = new Connector().new Process(source, m);
        assertSame("process.m", m, process.m);
        assertSame("process.source", source, process.source);
    }
View Full Code Here

    @Mock
    ISOClientSocketFactory socketFactory;

    @Test
    public void testAcceptThrowsNullPointerException() throws Throwable {
        BaseChannel xMLChannel = new XMLChannel(new PostPackager());
        try {
            xMLChannel.accept(null);
            fail("Expected NullPointerException to be thrown");
        } catch (NullPointerException ex) {
            assertNull("ex.getMessage()", ex.getMessage());
            assertNull("(XMLChannel) xMLChannel.logger", ((XMLChannel) xMLChannel).logger);
            assertNull("(XMLChannel) xMLChannel.originalRealm", ((XMLChannel) xMLChannel).originalRealm);
            assertNull("(XMLChannel) xMLChannel.serverIn", ((XMLChannel) xMLChannel).serverIn);
            assertNull("(XMLChannel) xMLChannel.serverOut", ((XMLChannel) xMLChannel).serverOut);
            assertNull("(XMLChannel) xMLChannel.getSocket()", xMLChannel.getSocket());
            assertEquals("(XMLChannel) xMLChannel.cnt.length", 3, ((XMLChannel) xMLChannel).cnt.length);
            assertNull("(XMLChannel) xMLChannel.realm", ((XMLChannel) xMLChannel).realm);
            assertFalse("(XMLChannel) xMLChannel.usable", ((XMLChannel) xMLChannel).usable);
        }
    }
View Full Code Here

    }

    @Test
    public void testGetDynamicPackager() throws Throwable {
        ISOPackager p = new PostPackager();
        BaseChannel xMLChannel = new XMLChannel();
        xMLChannel.setPackager(p);
        ISOPackager result = xMLChannel.getDynamicPackager(new ISOMsg());
        assertSame("result", p, result);
    }
View Full Code Here

        assertEquals("result", 0, result);
    }

    @Test
    public void testGetHeaderLength2() throws Throwable {
        BaseChannel xMLChannel = new XMLChannel();
        final byte[] bytes = new byte[12];
        bytes[0] = (byte) 22;
        bytes[1] = (byte) 1;
        bytes[2] = (byte) 2;
        bytes[3] = (byte) 0;
        bytes[4] = (byte) 0;
        bytes[5] = (byte) 0;
        bytes[6] = (byte) 0;
        bytes[7] = (byte) 0;
        bytes[8] = (byte) 0;
        bytes[9] = (byte) 0;
        bytes[10] = (byte) 0;
        bytes[11] = (byte) 0;
        when(m.getHeader()).thenReturn(bytes);
        int result = xMLChannel.getHeaderLength(m);
        assertEquals("result", 12, result);
    }
View Full Code Here

        assertSame("result", socketFactory, result);
    }

    @Test
    public void testIsConnected() throws Throwable {
        boolean result = new XMLChannel(new ISO87APackager()).isConnected();
        assertFalse("result", result);
    }
View Full Code Here

        }
    }

    @Test
    public void testSendMessageLength() throws Throwable {
        BaseChannel xMLChannel = new XMLChannel();
        xMLChannel.sendMessageLength(100);
        int actual = xMLChannel.getHeaderLength();
        assertEquals("(XMLChannel) xMLChannel.getHeaderLength()", 0, actual);
    }
View Full Code Here

        }
    }

    @Test
    public void testSendMessageTrailer() throws Throwable {
        BaseChannel xMLChannel = new XMLChannel(new PostPackager());
        xMLChannel.sendMessageTrailer(new ISOMsg(), new byte[]{100});
        int actual = xMLChannel.getHeaderLength();
        assertEquals("(XMLChannel) xMLChannel.getHeaderLength()", 0, actual);
    }
View Full Code Here

        assertEquals("(NACChannel) nACChannel.getTimeout()", -1, nACChannel.getTimeout());
    }

    @Test
    public void testShouldIgnore() throws Throwable {
        BaseChannel xMLChannel = new XMLChannel();
        byte[] b = new byte[0];
        boolean result = xMLChannel.shouldIgnore(b);
        assertFalse("result", result);
    }
View Full Code Here

    @Test
    public void serverSideDisconnect() throws Exception {
        ISOServer isoServer = newIsoServer();
        new Thread(isoServer).start();

        XMLChannel clientChannel = newClientChannel();

        clientChannel.connect();
        // need to push some traffic through to complete the SSL handshake
        clientChannel.send(new ISOMsg("0800"));
        assertThat(clientChannel.receive(), hasMti("0810"));

        isoServer.shutdown();

        try {
            clientChannel.receive();
            fail("clientChannel should be closed");
        } catch (Exception e) {
            assertThat(e, is(instanceOf(EOFException.class)));
        }
    }
View Full Code Here

TOP

Related Classes of org.jpos.iso.channel.XMLChannel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.