Hi,

I am using emulator for development.

I am trying to connect http://www.google.co.in/ from my Activity.

Inside my onCreate method I have the below piece of code.

                try {
                        // Specify proxy settings
                        // TODO: Move these settings to properties file
                        Properties sysProperties = System.getProperties();
                        sysProperties.put("proxyHost", "my ip address");
                        sysProperties.put("proxyPort", "my port");
                        sysProperties.put("proxySet", "true");
                        sysProperties.put("http.proxyUser", "name");
                        sysProperties.put("http.proxyPassword", "password");

                        URL u = new URL("http://www.google.co.in/";);
                        HttpURLConnection huc = (HttpURLConnection) 
u.openConnection();
                        huc.setRequestMethod("GET");
                        huc.setRequestProperty("Proxy-Authorization",
                                        "name:password");

                        huc.setDoOutput(true);
                        huc.connect();
                        System.out.println("Response : " + 
huc.getResponseMessage());
                        System.out.println("Response code :" + 
huc.getResponseCode());
                        InputStream is = huc.getInputStream();

                        BufferedReader in = new BufferedReader(new 
InputStreamReader(is));

                        String inputLine;

                        while ((inputLine = in.readLine()) != null)
                                System.out.println(inputLine);
                        in.close();
                        int code = huc.getResponseCode();
                        System.out.println("Http Response Code:" + code);

                        // if (HTTP_OK == code)
                        System.out.println("huc :" + huc);
                        // else
                        // return null;
                } catch (Exception e) {
                        e.printStackTrace();
                }


For the output of the above code I am getting the below error:

06-10 19:51:05.029: INFO/System.out(3258): Response : Proxy
Authentication Required ( The ISA Server requires authorization to
fulfill the request. Access to the Web Proxy filter is denied.  )
06-10 19:51:08.278: INFO/System.out(3258): Response code :407
06-10 19:51:11.927: WARN/System.err(3258):
java.io.FileNotFoundException: http://www.google.co.in/


I have added my credentilas in settings.db. Also I have added
http_proxy in my environment variable. Also I have tried to invoke my
emulator from command line. But I could not succeed.

Please let me know if any of you solved this kind of issue.

Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to