Examples of useProtocolVersion()


Examples of java.io.ObjectOutputStream.useProtocolVersion()

  public void checkStream(TestHarness harness) throws IOException
  {
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(os);
   
    oos.useProtocolVersion(ObjectStreamConstants.PROTOCOL_VERSION_2);
   
    oos.writeInt(1);
    oos.writeShort((short) 7);
    oos.writeFloat(9.96601f);
    oos.writeLong(-900000000000001l);
View Full Code Here

Examples of java.io.ObjectOutputStream.useProtocolVersion()

        ObjectOutputStream out = new ObjectOutputStream(bytes);

        try
          {
            // setting must be allowed
            out.useProtocolVersion(ObjectStreamConstants.PROTOCOL_VERSION_1);
            harness.check(true);
          }
        catch (RuntimeException e)
          {
            harness.check(false);
View Full Code Here

Examples of java.io.ObjectOutputStream.useProtocolVersion()

        // a subsequent call to useProtocolVersion must succeed also
        out.writeInt(4);

        try
          {
            out.useProtocolVersion(ObjectStreamConstants.PROTOCOL_VERSION_1);
            harness.check(true);
          }
        catch (IllegalStateException e)
          {
            harness.check(false);
View Full Code Here

Examples of java.io.ObjectOutputStream.useProtocolVersion()

        // subsequent calls must throw an exception
        out.writeObject(toSerialize);

        try
          {
            out.useProtocolVersion(ObjectStreamConstants.PROTOCOL_VERSION_1);
            harness.check(false);
          }
        catch (IllegalStateException e)
          {
            harness.check(true);
View Full Code Here

Examples of java.io.ObjectOutputStream.useProtocolVersion()

        out = new ObjectOutputStream(bytes);

        // wrong versions must throw IllegalArgumentException
        try
          {
            out.useProtocolVersion(4);
            harness.check(false);
          }
        catch (IllegalArgumentException e)
          {
            harness.check(true);
View Full Code Here

Examples of java.io.ObjectOutputStream.useProtocolVersion()

     */
    public void test_useProtocolVersionI_2() throws Exception {
        ObjectOutputStream oos = new ObjectOutputStream(
                new ByteArrayOutputStream());

        oos.useProtocolVersion(ObjectOutputStream.PROTOCOL_VERSION_1);
        oos.useProtocolVersion(ObjectOutputStream.PROTOCOL_VERSION_2);
        try {
            oos.useProtocolVersion(3);
            fail("Protocol 3 should not be accepted");
        } catch (IllegalArgumentException e) {
View Full Code Here

Examples of java.io.ObjectOutputStream.useProtocolVersion()

    public void test_useProtocolVersionI_2() throws Exception {
        ObjectOutputStream oos = new ObjectOutputStream(
                new ByteArrayOutputStream());

        oos.useProtocolVersion(ObjectOutputStream.PROTOCOL_VERSION_1);
        oos.useProtocolVersion(ObjectOutputStream.PROTOCOL_VERSION_2);
        try {
            oos.useProtocolVersion(3);
            fail("Protocol 3 should not be accepted");
        } catch (IllegalArgumentException e) {
            // expected
View Full Code Here

Examples of java.io.ObjectOutputStream.useProtocolVersion()

                new ByteArrayOutputStream());

        oos.useProtocolVersion(ObjectOutputStream.PROTOCOL_VERSION_1);
        oos.useProtocolVersion(ObjectOutputStream.PROTOCOL_VERSION_2);
        try {
            oos.useProtocolVersion(3);
            fail("Protocol 3 should not be accepted");
        } catch (IllegalArgumentException e) {
            // expected
        } finally {
            oos.close();
View Full Code Here

Examples of java.io.ObjectOutputStream.useProtocolVersion()

        // Cannot set protocol version when stream in-flight
        ObjectOutputStream out = new ObjectOutputStream(
                new ByteArrayOutputStream());
        out.writeObject("hello world");
        try {
            out.useProtocolVersion(ObjectStreamConstants.PROTOCOL_VERSION_1);
            fail("Expected IllegalStateException");
        } catch (IllegalStateException e) {
            // Expected
        }
    }
View Full Code Here

Examples of java.io.ObjectOutputStream.useProtocolVersion()

        // Cannot set protocol version when stream in-flight
        ObjectOutputStream out = new ObjectOutputStream(new ByteArrayOutputStream());
        out.writeObject("hello world");
        try {
            out.useProtocolVersion(ObjectStreamConstants.PROTOCOL_VERSION_1);
            fail("Expected IllegalStateException");
        } catch (IllegalStateException e) {
            // Expected
        }
    }
View Full Code Here
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.