@@ -0,0 +1,1944 @@
+//========================================================================%0D%0A//Copyright 2007-2009 David Yu dyuproject@gmail.com%0D%0A//------------------------------------------------------------------------%0D%0A//Licensed under the Apache License, Version 2.0 (the %22License%22);%0D%0A//you may not use this file except in compliance with the License.%0D%0A//You may obtain a copy of the License at %0D%0A//http://www.apache.org/licenses/LICENSE-2.0%0D%0A//Unless required by applicable law or agreed to in writing, software%0D%0A//distributed under the License is distributed on an %22AS IS%22 BASIS,%0D%0A//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0D%0A//See the License for the specific language governing permissions and%0D%0A//limitations under the License.%0D%0A//========================================================================%0D%0A%0D%0Apackage com.dyuproject.util.http;%0D%0A%0D%0Aimport java.io.InputStream;%0D%0Aimport java.util.Map;%0D%0A%0D%0Aimport junit.framework.TestCase;%0D%0A%0D%0Aimport com.dyuproject.util.http.HttpConnector.Response;%0D%0A%0D%0A/**%0D%0A * @author David Yu%0D%0A * @created Jan 7, 2009%0D%0A */%0D%0A%0D%0Apublic class SimpleHttpConnectorTest extends TestCase%0D%0A%7B%0D%0A    %0D%0A    public void test1() throws Exception%0D%0A    %7B%0D%0A        HttpConnector connector = new SimpleHttpConnector();%0D%0A        Response response = connector.doGET(%22http://dyuproject.googlecode.com/svn/trunk/README.txt%22, %0D%0A                (Map%3C?,?%3E)null);%0D%0A        assertTrue(response.getStatus()==200);%0D%0A        InputStream is = response.getInputStream();%0D%0A        try%0D%0A        %7B%0D%0A            byte%5B%5D buf = new byte%5BSimpleHttpConnector.getBufferSize()%5D;%0D%0A            for(int len=0; (len=is.read(buf))!=-1;)%0D%0A                System.err.print(new String(buf, 0, len));%0D%0A        %7D        %0D%0A        finally%0D%0A        %7B%0D%0A            try%0D%0A            %7B%0D%0A                is.close();%0D%0A            %7D%0D%0A            finally    %0D%0A            %7B%0D%0A                response.close();%0D%0A            %7D            %0D%0A        %7D%0D%0A    %7D%0D%0A%0D%0A%7D%0D%0A

move common http stuff to dyuproject-util