Examples of waitForDone()


Examples of org.eclipse.jetty.client.ContentExchange.waitForDone()

            ContentExchange contentExchange = new ContentExchange(true);
            contentExchange.setMethod("GET");
            contentExchange.setURL("http://" + host + ":" + port + "/get_books");
            httpClient.send(contentExchange);

            if (contentExchange.waitForDone() == HttpExchange.STATUS_COMPLETED) {
                return objectMapper.readValue(contentExchange.getResponseContent(), Book[].class);
            } else {
                throw new RuntimeException("Exception making request to retrieve all books");
            }
        } catch (Exception e) {
View Full Code Here

Examples of org.eclipse.jetty.client.ContentExchange.waitForDone()

            ContentExchange contentExchange = new ContentExchange(true);
            contentExchange.setMethod("GET");
            contentExchange.setURL("http://" + host + ":" + port + "/get_book" + "?id=" + id);
            httpClient.send(contentExchange);

            if (contentExchange.waitForDone() == HttpExchange.STATUS_COMPLETED) {
                return objectMapper.readValue(contentExchange.getResponseContent(), Book.class);
            } else {
                throw new RuntimeException("Exception making request to retrieve all books");
            }
View Full Code Here

Examples of org.eclipse.jetty.client.HttpExchange.waitForDone()

   
    public void checkRequest() throws Exception {
        if (caseParams.checkURI != null && caseParams.checkExpected != null) {
            HttpExchange httpConn = openConnection(getRestURL(caseParams.checkURI.trim()), "GET");
            httpClient.send(httpConn);
            httpConn.waitForDone();
            try {
                String actual = getOutput (httpConn);
                compareExpected (caseParams.caseName + " check expected response ", caseParams.checkExpected, actual);
            } finally {
                fullyDisconnect(httpConn);
View Full Code Here

Examples of org.mortbay.jetty.client.ContentExchange.waitForDone()

                    ContentExchange exchange1 = new ContentExchange(true);
                    exchange1.setMethod(HttpMethods.GET);
                    exchange1.setURL(urls[0] + "?action=init");
                    client.send(exchange1);
                    exchange1.waitForDone();
                    assert exchange1.getResponseStatus() == HttpServletResponse.SC_OK;
                    String sessionCookie = exchange1.getResponseFields().getStringField("Set-Cookie");
                    assert sessionCookie != null;

                    ExecutorService executor = Executors.newCachedThreadPool();
View Full Code Here

Examples of org.mortbay.jetty.client.ContentExchange.waitForDone()

                    ContentExchange exchange2 = new ContentExchange(true);
                    exchange2.setMethod(HttpMethods.GET);
                    exchange2.setURL(urls[0] + "?action=result");
                    exchange2.getRequestFields().add("Cookie", sessionCookie);
                    client.send(exchange2);
                    exchange2.waitForDone();
                    assert exchange2.getResponseStatus() == HttpServletResponse.SC_OK;
                    String response = exchange2.getResponseContent();
                    System.out.println("get = " + response);
                    assert response.trim().equals(String.valueOf(clientsCount * requestsCount));
                }
View Full Code Here

Examples of org.mortbay.jetty.client.ContentExchange.waitForDone()

                    ContentExchange exchange = new ContentExchange(true);
                    exchange.setMethod(HttpMethods.GET);
                    exchange.setURL(urls[urlIndex] + "?action=increment");
                    exchange.getRequestFields().add("Cookie", sessionCookie);
                    client.send(exchange);
                    exchange.waitForDone();
                    assert exchange.getResponseStatus() == HttpServletResponse.SC_OK;
                }

                // Wait for all workers to be done
                barrier.await();
View Full Code Here

Examples of org.mortbay.jetty.client.ContentExchange.waitForDone()

                // Perform a request, on server side a cross context dispatch will be done
                ContentExchange exchange = new ContentExchange(true);
                exchange.setMethod(HttpMethods.GET);
                exchange.setURL("http://localhost:" + port + contextA + servletMapping);
                client.send(exchange);
                exchange.waitForDone();
                assert exchange.getResponseStatus() == HttpServletResponse.SC_OK;
            }
            finally
            {
                client.stop();
View Full Code Here

Examples of org.mortbay.jetty.client.ContentExchange.waitForDone()

                    // Perform one request to server1 to create a session
                    ContentExchange exchange1 = new ContentExchange(true);
                    exchange1.setMethod(HttpMethods.GET);
                    exchange1.setURL("http://localhost:" + port1 + contextPath + servletMapping + "?action=set");
                    client.send(exchange1);
                    exchange1.waitForDone();
                    assert exchange1.getResponseStatus() == HttpServletResponse.SC_OK : exchange1.getResponseStatus();
                    String sessionCookie = exchange1.getResponseFields().getStringField("Set-Cookie");
                    assert sessionCookie != null;

                    // Perform a request to server2 using the session cookie from the previous request
View Full Code Here

Examples of org.mortbay.jetty.client.ContentExchange.waitForDone()

                    ContentExchange exchange2 = new ContentExchange(true);
                    exchange2.setMethod(HttpMethods.GET);
                    exchange2.setURL("http://localhost:" + port2 + contextPath + servletMapping + "?action=get");
                    exchange2.getRequestFields().add("Cookie", sessionCookie);
                    client.send(exchange2);
                    exchange2.waitForDone();
                    assert exchange2.getResponseStatus() == HttpServletResponse.SC_OK;
                }
                finally
                {
                    client.stop();
View Full Code Here

Examples of org.mortbay.jetty.client.ContentExchange.waitForDone()

                    int value = 1;
                    ContentExchange exchange1 = new ContentExchange(true);
                    exchange1.setMethod(HttpMethods.POST);
                    exchange1.setURL("http://localhost:" + port1 + contextPath + servletMapping + "?action=set&value=" + value);
                    client.send(exchange1);
                    exchange1.waitForDone();
                    assert exchange1.getResponseStatus() == HttpServletResponse.SC_OK;
                    String sessionCookie = exchange1.getResponseFields().getStringField("Set-Cookie");
                    assert sessionCookie != null;

                    // Perform a request to server2 using the session cookie from the previous request
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.