Package org.apache.http.impl.io

Examples of org.apache.http.impl.io.HttpDataOutputStream


        return new TestSuite(TestHttpDataOutputStream.class);
    }

    public void testConstructor() throws Exception {
        HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
        new HttpDataOutputStream(transmitter);
        try {
            new HttpDataOutputStream(null);
            fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            //expected
        }
    }
View Full Code Here


        }
    }
   
    public void testBasicWrite() throws Exception {
      HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
        HttpDataOutputStream outstream = new HttpDataOutputStream(transmitter);
        outstream.write(new byte[] {'a', 'b'}, 0, 2);
        outstream.write('c');
        outstream.flush();
       
        byte[] input = transmitter.getData();
       
        assertNotNull(input);
        byte[] expected = new byte[] {'a', 'b', 'c'};
View Full Code Here

        }
    }
   
    public void testClosedCondition() throws Exception {
      HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
        HttpDataOutputStream outstream = new HttpDataOutputStream(transmitter);
        outstream.close();
        outstream.close();
       
        try {
            byte[] tmp = new byte[2];
            outstream.write(tmp, 0, tmp.length);
            fail("IllegalStateException should have been thrown");
        } catch (IllegalStateException e) {
            //expected
        }
        try {
            outstream.write('a');
            fail("IllegalStateException should have been thrown");
        } catch (IllegalStateException e) {
            //expected
        }
        try {
            outstream.flush();
            fail("IllegalStateException should have been thrown");
        } catch (IllegalStateException e) {
            //expected
        }
    }
View Full Code Here

        return new TestSuite(TestHttpDataOutputStream.class);
    }

    public void testConstructor() throws Exception {
        HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
        new HttpDataOutputStream(transmitter);
        try {
            new HttpDataOutputStream(null);
            fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            //expected
        }
    }
View Full Code Here

        }
    }
   
    public void testBasicWrite() throws Exception {
      HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
        HttpDataOutputStream outstream = new HttpDataOutputStream(transmitter);
        outstream.write(new byte[] {'a', 'b'}, 0, 2);
        outstream.write('c');
        outstream.flush();
       
        byte[] input = transmitter.getData();
       
        assertNotNull(input);
        byte[] expected = new byte[] {'a', 'b', 'c'};
View Full Code Here

        }
    }
   
    public void testClosedCondition() throws Exception {
      HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
        HttpDataOutputStream outstream = new HttpDataOutputStream(transmitter);
        outstream.close();
        outstream.close();
       
        try {
            byte[] tmp = new byte[2];
            outstream.write(tmp, 0, tmp.length);
            fail("IllegalStateException should have been thrown");
        } catch (IllegalStateException e) {
            //expected
        }
        try {
            outstream.write('a');
            fail("IllegalStateException should have been thrown");
        } catch (IllegalStateException e) {
            //expected
        }
        try {
            outstream.flush();
            fail("IllegalStateException should have been thrown");
        } catch (IllegalStateException e) {
            //expected
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.http.impl.io.HttpDataOutputStream

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.