Package org.apache.harmony.xnet.provider.jsse

Examples of org.apache.harmony.xnet.provider.jsse.HandshakeIODataStream


        Finished message = new Finished(bytes);
        assertEquals("incorrect type", Handshake.FINISHED, message.getType());
        assertTrue("incorrect CertificateVerify", Arrays.equals(message
                .getData(), bytes));

        HandshakeIODataStream out = new HandshakeIODataStream();
        message.send(out);
        byte[] encoded = out.getData(1000);
        assertEquals("incorrect out data length", message.length(),
                encoded.length);

        HandshakeIODataStream in = new HandshakeIODataStream();
        in.append(encoded);
        Finished message_2 = new Finished(in, message.length());
        assertTrue("incorrect message decoding", Arrays.equals(message
                .getData(), message_2.getData()));

        in.append(encoded);
        try {
            message_2 = new Finished(in, message.length() - 1);
            fail("Small length: No expected AlertException");
        } catch (AlertException e) {
        }

        in.append(encoded);
        in.append(new byte[] { 1, 2, 3 });
        try {
            message_2 = new Finished(in, message.length() + 3);
            fail("Extra bytes: No expected AlertException ");
        } catch (AlertException e) {
        }
View Full Code Here


        HelloRequest message = new HelloRequest();
        assertEquals("incorrect type", Handshake.HELLO_REQUEST, message
                .getType());
        assertEquals("incorrect HelloRequest", 0, message.length());

        HandshakeIODataStream out = new HandshakeIODataStream();
        message.send(out);
        byte[] encoded = out.getData(1000);
        assertEquals("incorrect out data length", message.length(),
                encoded.length);

        HandshakeIODataStream in = new HandshakeIODataStream();
        in.append(encoded);
        HelloRequest message_2 = new HelloRequest(in, message.length());
        assertEquals("incorrect message decoding", 0, message_2.length());

        in.append(encoded);
        try {
            new HelloRequest(in, message.length() - 1);
            fail("Small length: No expected AlertException");
        } catch (AlertException e) {
        }

        in.append(encoded);
        in.append(new byte[] { 1, 2, 3 });
        try {
            new HelloRequest(in, message.length() + 3);
            fail("Extra bytes: No expected AlertException ");
        } catch (AlertException e) {
        }
View Full Code Here

        ServerHelloDone message = new ServerHelloDone();
        assertEquals("incorrect type", Handshake.SERVER_HELLO_DONE, message
                .getType());
        assertEquals("incorrect ServerHelloDone", 0, message.length());

        HandshakeIODataStream out = new HandshakeIODataStream();
        message.send(out);
        byte[] encoded = out.getData(1000);
        assertEquals("incorrect out data length", message.length(),
                encoded.length);

        HandshakeIODataStream in = new HandshakeIODataStream();
        in.append(encoded);
        ServerHelloDone message_2 = new ServerHelloDone(in, message.length());
        assertEquals("incorrect message decoding", 0, message_2.length());

        in.append(encoded);
        try {
            new ServerHelloDone(in, message.length() - 1);
            fail("Small length: No expected AlertException");
        } catch (AlertException e) {
        }

        in.append(encoded);
        in.append(new byte[] { 1, 2, 3 });
        try {
            new ServerHelloDone(in, message.length() + 3);
            fail("Extra bytes: No expected AlertException ");
        } catch (AlertException e) {
        }
View Full Code Here

TOP

Related Classes of org.apache.harmony.xnet.provider.jsse.HandshakeIODataStream

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.