1   /**
2    *  MicroEmulator
3    *  Copyright (C) 2006-2007 Bartek Teodorczyk <barteo@barteo.net>
4    *  Copyright (C) 2006-2007 Vlad Skarzhevskyy
5    *
6    *  This library is free software; you can redistribute it and/or
7    *  modify it under the terms of the GNU Lesser General Public
8    *  License as published by the Free Software Foundation; either
9    *  version 2.1 of the License, or (at your option) any later version.
10   *
11   *  This library is distributed in the hope that it will be useful,
12   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   *  Lesser General Public License for more details.
15   *
16   *  You should have received a copy of the GNU Lesser General Public
17   *  License along with this library; if not, write to the Free Software
18   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19   *
20   *  @version $Id: HttpConnectionTest.java 887 2007-02-13 08:16:30Z vlads $
21   */
22  package javax.microedition.io;
23  
24  import java.io.IOException;
25  
26  public class HttpConnectionTest extends BaseTestHttpConnection {
27  
28  	private static final String testInetHTTPUrl = "http://" + TEST_HOST + testFile;
29  
30      public void testConnection() throws IOException {
31      	HttpConnection hc = (HttpConnection)Connector.open(testInetHTTPUrl, Connector.READ, true);
32          try {
33  			assertEquals("getResponseCode()", HttpConnection.HTTP_OK, hc.getResponseCode());
34  			assertEquals("getPort()", 80, hc.getPort());
35  			assertEquals("getProtocol()", "http", hc.getProtocol());
36  			assertEquals("getURL()", testInetHTTPUrl, hc.getURL());
37  			assertHttpConnectionMethods(hc);
38  		} finally {
39  			hc.close();
40  		}
41      }
42      
43      protected HttpConnection openHttpConnection(String query) throws IOException {
44      	return (HttpConnection)Connector.open("http://" + TEST_HOST + query, Connector.READ, true);
45      }
46  }