Code example for ConnectException

0
                    Log.d(LOG_SERVER, "Logged to the server.");
                    setCookiePref(mSessionCookie);
                } else { 
                    errorDisplayAndSettings(BAD_LOGIN_ERROR);
                    setCookiePref(null); 
                    throw new ConnectException(BAD_LOGIN_ERROR);
                } 
            } else { 
                throw new ConnectException(NO_RESPONSE_SERVER_ERROR);
            } 
        } catch (UnsupportedEncodingException e) {
            throw new ConnectException(UNEXPECTED_RESPONSE_ERROR
                    + " unsupported encoding exception."); 
        } catch (JSONException e) {
            throw new ConnectException(UNEXPECTED_RESPONSE_ERROR
                    + " server didn't response success on login."); 
        } 
    } 
 
    /** 
     * Private constructor to do first instance.