Examples of RequestBuilder


Examples of org.atmosphere.wasync.RequestBuilder

        final AtomicReference<EventPOJO> open = new AtomicReference<EventPOJO>();
        final AtomicReference<EventPOJO> close = new AtomicReference<EventPOJO>();

        Client client = ClientFactory.getDefault().newClient();

        RequestBuilder request = client.newRequestBuilder()
                .method(Request.METHOD.GET)
                .uri(targetUrl + "/suspend")
                .decoder(new Decoder<String, POJO>() {
                    @Override
                    public POJO decode(Event e, String s) {
                        if (e.equals(Event.MESSAGE)) {
                            return new POJO(s);
                        } else {
                            return null;
                        }
                    }
                })
                .decoder(new Decoder<String, EventPOJO>() {
                    @Override
                    public EventPOJO decode(Event e, String s) {
                        return new EventPOJO(e, s);
                    }
                })
                .transport(transport());

        Socket socket = client.create();
        socket.on(new Function<POJO>() {
            @Override
            public void on(POJO t) {
                response.set(t);
                latch.countDown();
            }
        }).on(Event.OPEN, new Function<EventPOJO>() {
            @Override
            public void on(EventPOJO t) {
                open.set(t);
                latch.countDown();
            }
        }).on(Event.CLOSE, new Function<EventPOJO>() {
            @Override
            public void on(EventPOJO t) {
                close.set(t);
                xlatch.countDown();
            }
        }).open(request.build()).fire("echo");

        latch.await(5, TimeUnit.SECONDS);

        socket.close();
View Full Code Here

Examples of org.atmosphere.wasync.RequestBuilder

    @Test
    public void testTimeoutAtmosphereClient() throws IOException, InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        AtmosphereClient client = ClientFactory.getDefault().newClient(AtmosphereClient.class);
        RequestBuilder request = client.newRequestBuilder()
                .method(Request.METHOD.GET)
                .uri(targetUrl)
                .trackMessageLength(true)
                .transport(transport());

        Socket socket = client.create();
        IOException ioException = null;
        try {
            socket.on(new Function<ConnectException>() {

                @Override
                public void on(ConnectException t) {
                    latch.countDown();
                }

            }).on(Event.CLOSE.name(), new Function<String>() {
                @Override
                public void on(String t) {
                    logger.info("Connection closed");
                }
            }).open(request.build());
        } catch (IOException ex) {
            ioException = ex;
        }

        assertTrue(latch.await(10, TimeUnit.SECONDS));
View Full Code Here

Examples of org.jboss.dna.graph.request.RequestBuilder

        this.nextGraph = new Conjunction<Graph>() {
            public Graph and() {
                return Graph.this;
            }
        };
        this.requests = new RequestBuilder() {
            @Override
            protected <T extends Request> T process( T request ) {
                Graph.this.execute(request);
                return request;
            }
View Full Code Here

Examples of org.openstack.client.common.RequestBuilder

      openstackProperties.getCustomProperties().put(key, entry.getValue());
    }

    log.info("Uploading to " + getContainerName() + "/" + objectPath);

    RequestBuilder requestBuilder = getStorageClient(request.target).root().containers().id(getContainerName())
        .objects().buildPutRequest(openstackProperties);

    CurlRequest curlRequest = ((RemoteCurlOpenstackRequest) requestBuilder).toCurlRequest();
    curlRequest.bodyFromStdin = true;
View Full Code Here

Examples of org.springframework.test.web.servlet.RequestBuilder

   *   .andExpect(content().string("{\"name\":\"Joe\",\"someDouble\":0.0,\"someBoolean\":false}"));
   * </pre>
   * @param mvcResult the result from the request that started async processing
   */
  public static RequestBuilder asyncDispatch(final MvcResult mvcResult) {
    return new RequestBuilder() {
      @Override
      public MockHttpServletRequest buildRequest(ServletContext servletContext) {
        MockHttpServletRequest request = mvcResult.getRequest();
        request.setAsyncStarted(false);
        return 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.