Troubleshooting guide

125
7: Creating connections
keepGoing = false;
}
break;
default:
//The connection failed for some other reason.
//Handle failed connection.
keepGoing = false;
break;
}
}
//Close the connection.
s.close();
}
catch (IOException e)
{
//Handle the exception.
}
Use HTTPS connections
Use socket connections
Although you can implement HTTP over a socket connection, you should use an HTTP connection for the following
reasons:
Socket connections do not support the BlackBerry® Mobile Data System™ features, such as push.
Task Steps
Before opening an HTTPS connection,
verify that the BlackBerry® device is
within a wireless coverage area.
>Use the CoverageInfo class and CoverageStatusListener interface of the
net.rim.device.api.system package to make sure that the BlackBerry device is in a
wireless coverage area.
Open an HTTPS connection. 1. Invoke Connector.open(), specifying HTTPS as the protocol.
2. Cast the returned object as an HttpsConnection object.
HttpsConnection stream = (HttpsConnection)Connector.open("https://
host:443/");
Specify the connection mode. > To open an HTTPS connection in end-to-end mode, add one of the following parameters to the
connection string that passes to
Connector.open():
Specify that an end-to-end HTTPS connection must be used from the BlackBerry device to
the target server:
EndToEndRequired.
Specify that an end-to-end HTTPS connection should be used from the BlackBerry device
to the target server. If the BlackBerry device does not support end-to-end TLS, and the
BlackBerry device user permits proxy TLS connections, then a proxy connection is used:
EndToEndDesired.
HttpsConnection stream = (HttpsConnection)Connector.open("https://
host:443/;EndToEndDesired");