Code example for ConnectException

0
	 * @throws ConnectException 
	 */ 
	private static String getXML(Context context, String url, List<NameValuePair> postVariables)
			throws ConnectException { 
		if (!checkInternetConnection(context)) {
			throw new ConnectException("Connection Not available");
		} 
		String line = null;
 
		try { 
			DefaultHttpClient httpClient = new DefaultHttpClient();
			HttpPost httpPost = new HttpPost(url);
			httpPost.setEntity(new UrlEncodedFormEntity(postVariables));
 
			HttpResponse httpResponse = httpClient.execute(httpPost);
			HttpEntity httpEntity = httpResponse.getEntity();
			line = EntityUtils.toString(httpEntity);
		} catch (UnsupportedEncodingException e) {
			line = "<results status=\"error\"><msg>Can't connect to server</msg></results>";
		} catch (MalformedURLException e) {
			line = "<results status=\"error\"><msg>Can't connect to server</msg></results>";