Package com.sun.jini.test.spec.jeri.mux.util

Examples of com.sun.jini.test.spec.jeri.mux.util.DataMessage


        //of 256 bytes
        ServerConnectionHeader sHeader = new ServerConnectionHeader();
        sHeader.setRation((short)0x0001).send(os);
        int receivedBytes = 0;
        long stopTime = System.currentTimeMillis() + getTimeout()*5;
        DataMessage dm = new DataMessage().suppressFormatCheck();
        dm.receive(is,getTimeout());
        receivedBytes += dm.getSize();
        //Verify that no more that 256 bytes are received
        if (dm.getSize()>256) {
            throw new TestException("More than 256 bytes"
                + " were sent");
        }
        //Send an Close message
        int sessionId = dm.getsessionId();
        DataMessage eof = new DataMessage().setEof()
            .setSessionID((byte)sessionId);
        eof.send(os);
        CloseMessage cm = new CloseMessage();
        cm.send(os);
        if (!abortReceived(is)) {
            throw new TestException("The client did not"
                + " send an Abort message");
View Full Code Here


        sHeader.setRation((short)0x0001).send(os);
        int receivedBytes = 0;
        long stopTime = System.currentTimeMillis() + getTimeout()*5;
        long messageTime = getTimeout();
        do {
            DataMessage dm = new DataMessage().suppressFormatCheck();
            //new TimedReceiveTask(dm,is,getTimeout());
            dm.receive(is,messageTime);
            receivedBytes += dm.getSize();
            if (receivedBytes==expectedBytes) {
                break;
            }
            //Verify that no more that 256 bytes are received
            if (dm.getSize()>256) {
                throw new TestException("More than 256 bytes"
                    + " were sent");
            }
            int session = dm.getsessionId();
            //Verify that no data is sent before an increment ration
            //message is sent;
            DataMessage dummy = new DataMessage().suppressFormatCheck();
            boolean dataSent = true;
            dummy.receive(is,messageTime);
            if (dummy.getSize()>0) {
                throw new TestException("Data was sent before"
                    + " the server sent an increment ration message");
            }
            //request that an additional 256 bytes be sent
            IncrementRationMessage increment = new IncrementRationMessage();
View Full Code Here

        //Send a ServerConnectionHeader
        ServerConnectionHeader sHeader = new ServerConnectionHeader();
        sHeader.send(os);
        //Verify that a properly formatted Data message with 100
        //data bytes is received
        DataMessage dm = new DataMessage();
        try {
            //verify that the open and eof flags are set on the data
            //message
            dm.setOpen().setEof().receive(is,getTimeout());
        } catch (ProtocolException e) {
            e.printStackTrace();
            throw new TestException(e.getMessage(),e);
        }
        //verify that 600 bytes are received
        byte[] payload = (byte[])dm.getPayload();
        if (payload.length!=600) {
            //try once again - it is possible the message was split
            try {
               dm.receive(is,getTimeout());
            } catch (ProtocolException e) {
                e.printStackTrace();
                throw new TestException(e.getMessage(),e);
            }
        }
        if (dm.getSize()!=600) {
            throw new TestException("Test did not receive"
                + " the expected number of bytes");
        }
        //Respond with a Data message that requires acknowledgement
        dm = new DataMessage();
        dm.setEof().setSessionID((byte)0x00).setPayload(
            new byte[] {(byte)0x16,(byte)0x16}).setSize((short)2)
            .setSessionID((byte) 0x00).setEof().setClose().setAckRequired();
        dm.send(os);
        //Verify that a properly formatted acknowledgement message is
        //received
        AcknowledgementMessage am = new AcknowledgementMessage();
        try {
            am.receive(is,getTimeout());
View Full Code Here

        os.write(data);
        os.flush();
        int received = 0;
        int sessionId = 0;
        //Receive message fragment
        DataMessage dm = new DataMessage().suppressFormatCheck();
        dm.receive(is,getTimeout());
        if (dm.getSize()>256) {
            throw new TestException("Message fragment size"
                + " over 256 bytes: " + dm);
        }
        AbortMessage am = new AbortMessage();
        am.send(os);
View Full Code Here

        os.flush();
        int received = 0;
        int sessionId = 0;
        while (received < size) {
            //Receive message fragment
            DataMessage dm = new DataMessage().suppressFormatCheck();
            dm.receive(is,getTimeout());
            int dataSize = dm.getSize();
            if (dataSize > 256) {
                throw new TestException("Message fragment size"
                    + " over 256 bytes: " + dm);
            } else if (dataSize > 0) {
                received += dm.getSize();
                sessionId = dm.getsessionId();
                //Send an increment ration of 256 bytes
                IncrementRationMessage ir = new IncrementRationMessage()
                    .setIncrement( (byte) 0, (short) 0x0100)
                    .setSessionID( (byte) sessionId);
                ir.send(os);
View Full Code Here

        //of 256 bytes
        ServerConnectionHeader sHeader = new ServerConnectionHeader();
        sHeader.setRation((short)0x0001).send(os);
        int receivedBytes = 0;
        long stopTime = System.currentTimeMillis() + getTimeout()*5;
        DataMessage dm = new DataMessage().suppressFormatCheck();
        dm.receive(is,getTimeout());
        receivedBytes += dm.getSize();
        //Verify that no more that 256 bytes are received
        if (dm.getSize()>256) {
            throw new TestException("More than 256 bytes"
                + " were sent");
        }
        //Send an Abort message
        AbortMessage am = new AbortMessage();
View Full Code Here

TOP

Related Classes of com.sun.jini.test.spec.jeri.mux.util.DataMessage

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.