Package java.net

Examples of java.net.HttpURLConnection.usingProxy()


        assertTrue("Connection does not use proxy", connection.usingProxy());
        assertTrue("Proxy server was not used", proxy.accepted);
       
        HttpURLConnection huc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY);
        assertFalse(huc.usingProxy());
    }

    /**
     * Test checks if the proxy provided by proxy selector
     * will be used for connection to the server
View Full Code Here


            // wait while server and proxy run
            server.join();
            proxy.join();

            assertTrue("Connection does not use proxy",
                                            connection.usingProxy());
            assertTrue("Proxy server was not used", proxy.accepted);
        } finally {
            // restore default proxy selector
            ProxySelector.setDefault(defPS);
        }
View Full Code Here

        // wait while server and proxy run
        server.join();
        proxy.join();

        assertTrue("Connection does not use proxy", connection.usingProxy());
        assertTrue("Proxy server was not used", proxy.accepted);

        HttpURLConnection huc = (HttpURLConnection) url
                .openConnection(Proxy.NO_PROXY);
        assertFalse(huc.usingProxy());
View Full Code Here

        assertTrue("Connection does not use proxy", connection.usingProxy());
        assertTrue("Proxy server was not used", proxy.accepted);

        HttpURLConnection huc = (HttpURLConnection) url
                .openConnection(Proxy.NO_PROXY);
        assertFalse(huc.usingProxy());
    }

    /**
     * @tests HttpURLConnection.usingProxy
     */
 
View Full Code Here

            System.setProperty("http.proxyPort", jettyPort + "");
            URL url = new URL(jettyURL);
            HttpURLConnection urlConnect = (HttpURLConnection) url
                    .openConnection();
            urlConnect.getInputStream();
            assertTrue(urlConnect.usingProxy());
           
            // find a free port
            ServerSocket serverSocket = new ServerSocket(0);
            int port = serverSocket.getLocalPort();
            serverSocket.close();
View Full Code Here

           
            System.setProperty("http.proxyPort", port + "");
            url = new URL(jettyURL);
            urlConnect = (HttpURLConnection) url.openConnection();
            urlConnect.getInputStream();
            assertFalse(urlConnect.usingProxy());
           
            url = new URL("http://localhost:" + port);
            urlConnect = (HttpURLConnection) url.openConnection();
            try {
                urlConnect.getInputStream();
View Full Code Here

                urlConnect.getInputStream();
                fail("should throw ConnectException");
            } catch (ConnectException e) {
                // Expected
            }
            assertFalse(urlConnect.usingProxy());
        } finally {
            System.setProperties(null);
        }
    }
View Full Code Here

            // wait while server and proxy run
            server.join();
            proxy.join();

            assertTrue("Connection does not use proxy", connection.usingProxy());
            assertTrue("Proxy server was not used", proxy.accepted);
        } finally {
            // restore default proxy selector
            ProxySelector.setDefault(defPS);
        }
View Full Code Here

      if (urlConnection instanceof HttpURLConnection) {
        logMessage("Update checking with http.");
        HttpURLConnection h = (HttpURLConnection) urlConnection;

        if (h.usingProxy()) {
          logMessage("http using proxy.");
        }
      }
      inputStream = urlConnection.getInputStream();
      inputStreamReader = new InputStreamReader(inputStream);
View Full Code Here

        // wait while server and proxy run
        server.join();
        proxy.join();

        assertTrue("Connection does not use proxy", connection.usingProxy());
        assertTrue("Proxy server was not used", proxy.accepted);

        HttpURLConnection huc = (HttpURLConnection) url
                .openConnection(Proxy.NO_PROXY);
        assertFalse(huc.usingProxy());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.