Package javaflow.network.impl

Source Code of javaflow.network.impl.TestSendingThrowsException

package javaflow.network.impl;

import javaflow.components.api.Component;
import javaflow.components.api.InputPort;
import javaflow.components.api.OutputPort;
import javaflow.components.api.Packet;
import javaflow.components.api.PortIsClosed;

public class TestSendingThrowsException implements Component {

    InputPort in;
    OutputPort out;
    OutputPort result;

    @Override
    public void execute() {

        Packet packet = in.receive();
        result.createPacket("testing").send();
        try {
            out.send(packet);
            // Expect exception to be thrown from sending dropped packet
            result.createPacket("failed").send();
        } catch (PortIsClosed e) {
            packet.drop();
            result.createPacket("success").send();
        }
    }
}
TOP

Related Classes of javaflow.network.impl.TestSendingThrowsException

TOP
Copyright © 2018 www.massapi.com. 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.