* @param password password for login
* @return the challenge response to be sent to notification server.
*/
private static String loginServerAuthenticate(String url, ProxyInfo info, String challenge, String username, String password) throws IOException
{
HamsamHttpsConnection conn = new HamsamHttpsConnection(url, info);
conn.setHeaderField("Authorization", "Passport1.4 " +
"OrgVerb=GET," +
"OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom," +
"sign-in=" + urlEncode(username) + "," +
"pwd=" + password + "," +
challenge);
conn.setHeaderField("User-Agent", "MSMSGS");
conn.doRequest();
String ret = conn.getHeaderField("Authentication-Info");
int start = ret.indexOf("da-status=") + 10;
int end = ret.indexOf(',', start);
String status = ret.substring(start, end);
if(!"success".equals(status))
return null;