Hello i just begin with http connection, and i am i trouble with it. When i call any of connection with WAP my emulator just hange up, my phone start to installa aplication and throw exception system error. I use phone nokia 7650, I found on forum this code and i try to download by it any of png file

public void polacz()
throws Exception
{
HttpConnection conn = (HttpConnection)Connector.open("http://wp.pl",Connector.READ);

// HEADERS------------------------------------------------------
conn.setRequestMethod( HttpConnection.GET );
conn.setRequestProperty("User-Agent",
"Profile/MIDP-1.0 Configuration/CLDC-1.0");
conn.setRequestProperty( "Accept", "image/png" );
conn.setRequestProperty("Content-Type", "image/png");

if( conn!= null ) {
if ( conn.getResponseCode() == HttpConnection.HTTP_OK &&
conn.getType().toLowerCase().indexOf("image/png") != -1 )
{

DataInputStream iStrm = conn.openDataInputStream();

Image img = null;
byte [] imageData = null;

int strmLength = (int) conn.getLength();

if( strmLength == -1 )
{ // Reading from an HTTP 1.0 server or a chunked HTTP 1.1
ByteArrayOutputStream bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
bStrm.flush();
imageData = bStrm.toByteArray();
bStrm.close();
}
else {
// Reading a Content-Length labeled payload
imageData = new byte[strmLength];
iStrm.readFully(imageData);
}

// midlet.formMainScreen.append("ImageData.length: "+imageData.length);

try {
img = Image.createImage(imageData, 0, imageData.length);
}catch(java.lang.IllegalArgumentException iae) {
// writeMessage("Erro: ",
// "Ocorreu um erro ao criar a imagem...Illegal arg: "
// +iae.getMessage());

}catch(Exception e) {
// writeMessage("Erro: ",
// "Ocorreu um erro ao criar a imagem..." +e);
}
finally {
if( iStrm != null ) iStrm.close();
if( conn != null ) conn.close();
// if( img != null ) this.setMapImage(img);

}
}
}}

I even dont now where my problem are located. I onlu now that when HttpConnection conn = (HttpConnection)Connector.open("http://wp.pl",Connector.READ);
line are executed the emulator stops.