Search in sources :

Example 6 with XMLChannel

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

the class ConnectorTest method testProcessConstructor.

@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);
}
Also used : EuroPackager(org.jpos.iso.packager.EuroPackager) ServerSocket(java.net.ServerSocket) XMLChannel(org.jpos.iso.channel.XMLChannel) Test(org.junit.Test)

Example 7 with XMLChannel

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

the class SslChannelIntegrationTest method serverSideDisconnect.

@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)));
    }
}
Also used : EOFException(java.io.EOFException) XMLChannel(org.jpos.iso.channel.XMLChannel) IOException(java.io.IOException) EOFException(java.io.EOFException) Test(org.junit.Test)

Example 8 with XMLChannel

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

the class SslChannelIntegrationTest method newIsoServer.

private ISOServer newIsoServer() throws IOException, ISOException {
    XMLChannel clientSide = new XMLChannel(new XMLPackager());
    clientSide.setLogger(logger, "server.channel");
    ISOServer isoServer = new ISOServer(PORT, clientSide, new ThreadPool());
    isoServer.setSocketFactory(new SunJSSESocketFactory());
    isoServer.setConfiguration(serverConfiguration());
    isoServer.setLogger(logger, "server");
    isoServer.addISORequestListener(new TestListener());
    return isoServer;
}
Also used : XMLPackager(org.jpos.iso.packager.XMLPackager) ThreadPool(org.jpos.util.ThreadPool) XMLChannel(org.jpos.iso.channel.XMLChannel)

Aggregations

XMLChannel (org.jpos.iso.channel.XMLChannel)8 Test (org.junit.Test)6 PostPackager (org.jpos.iso.packager.PostPackager)2 XMLPackager (org.jpos.iso.packager.XMLPackager)2 EOFException (java.io.EOFException)1 IOException (java.io.IOException)1 ServerSocket (java.net.ServerSocket)1 EuroPackager (org.jpos.iso.packager.EuroPackager)1 ISO87APackager (org.jpos.iso.packager.ISO87APackager)1 ThreadPool (org.jpos.util.ThreadPool)1