It should look something like this:
Code:
import java.io.*;
import javax.microedition.io.*;
String url = "http://www.google.com";
HttpConnection conn = null;
InputStream in = null;
try {
conn = (HttpConnection) Connector.open( url );
int rc = conn.getResponseCode();
if( rc == HttpConnection.HTTP_OK ){
in = conn.openInputStream();
}
}
catch( IOException e ){
System.out.println( "IOException: " + e.toString() );
}
catch( Exception e ){
System.out.println( "Exception: " + e.toString() );
}
finally {
if( in != null ){
try { in.close(); } catch( IOException e ){System.out.println( "IOException: " + e.toString() );}
}
if( conn != null ){
try { conn.close(); } catch( IOException e ){System.out.println( "IOException: " + e.toString() );}
}
}
I assume the HTTP connection happens in a separate thread so it could easily be missed.
Try using the JDE debugger to view more info.