Package net.jini.io

Examples of net.jini.io.MarshalInputStream


    void checkPostUnmarshallingException(Throwable thrown,
        ByteArrayInputStream response) throws TestException
    {
        Throwable caught = null;
        try {
            MarshalInputStream marshalledResponse = new MarshalInputStream(
                response, null, false, null, new ArrayList());
            caught = (Throwable) marshalledResponse.readObject();
            assertion(marshalledResponse.read() == -1);
        } catch(Throwable t) {
            assertion(false,t.toString());
        }

        if (thrown instanceof Error) {
View Full Code Here


        // call dispatch and verify the proper result
        dispatcher.dispatch(impl,request,context);
        response = request.getResponseStream();
        assertion(response.read() == 0x02);
        MarshalInputStream mis = new MarshalInputStream(
            response,null,false,null,new ArrayList());
        assertion(mis.read() == -1);

        // iterate over test cases
        for (int i = 0; i < cases.length; i++) {
            logger.log(Level.FINE,"=================================");
            Throwable marshalThrowException = cases[i];
            logger.log(Level.FINE,"test case " + (counter++)
                + ": " + marshalThrowException);
            logger.log(Level.FINE,"");

            // initialize FakeBasicInvocationDispatcher
            dispatcher.setMarshalThrowException(marshalThrowException);

            // initialize FakeRemoteImpl
            impl.setFakeMethodException(new RemoteException());

            // initialize FakeInboundRequest
            request = new FakeInboundRequest(methodHash,nullArgs,0x00,0x00);

            // call dispatch and verify the proper result
            dispatcher.dispatch(impl,request,context);
            response = request.getResponseStream();
            assertion(response.read() == 0x02);
            mis = new MarshalInputStream(
                response,null,false,null,new ArrayList());
            assertion(mis.read() == -1);
        }
    }
View Full Code Here

        // call dispatch and verify the proper result
        dispatcher.dispatch(impl,request,context);
        response = request.getResponseStream();
        assertion(response.read() == 0x01);
        MarshalInputStream mis = new MarshalInputStream(
            response,null,false,null,new ArrayList());
        assertion(mis.read() == -1);

        // iterate over test cases
        for (int i = 0; i < cases.length; i++) {
            logger.log(Level.FINE,"=================================");
            Throwable marshalReturnException = cases[i];
            logger.log(Level.FINE,"test case " + (counter++)
                + ": marshalReturn exception: " + marshalReturnException);
            logger.log(Level.FINE,"");

            // initialize FakeBasicInvocationDispatcher
            dispatcher.setMarshalReturnException(
                marshalReturnException);

            // initialize FakeInboundRequest
            request = new FakeInboundRequest(methodHash,nullArgs,0x00,0x00);

            // call dispatch and verify the proper result
            dispatcher.dispatch(impl,request,context);
            response = request.getResponseStream();
            assertion(response.read() == 0x01);
            mis = new MarshalInputStream(
                response,null,false,null,new ArrayList());
            assertion(mis.read() == -1);
        }
    }
View Full Code Here

        throws IOException, ClassNotFoundException, TestException
    {
        ByteArrayInputStream requestStream = request.getRequestStream();
        assertion(requestStream.read() == 0x00)// verify protocol
        assertion(requestStream.read() == 0x00)// verify integrity
        MarshalInputStream mis = new MarshalInputStream(
            requestStream,null,false,null,new ArrayList());
        mis.readLong()// read but don't verify the method hash

        // read and verify method args
        if (params != null) {
            for (int i = 0; i < params.length; i++) {
                Object expected = params[i];
                if (expected == null) {
                    assertion(mis.readObject() == null);
                } else {
                    Object actual =Util.unmarshalValue(expected.getClass(),mis);
                    if (expected.getClass().isArray()) {
                        //contents unchecked
                    } else {
View Full Code Here

TOP

Related Classes of net.jini.io.MarshalInputStream

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.