Code example for ConnectException

0
 
		// Send the GET request and get the response code 
		responseCode = sendGetRequest(conn);
		if (responseCode != HttpURLConnection.HTTP_OK)
		{ 
			throw new ConnectException("Failed to get peer list from bootstrap peer");
		} 
 
		return new BufferedInputStream(conn.getInputStream());
	} 
	 
	private PeerSet getPeerList(URL bootstrapUrl) throws IOException, JSONException
	{ 
		URL queryUrl;
		Scanner in;
		PeerSet peerSet;
		JSONArray jsonPeerList;
		String json;
		 
		// Build the query peer list URL 
		queryUrl = createQueryUrl(bootstrapUrl, "peerlist");