Examples of ClientTransport


Examples of org.cometd.client.transport.ClientTransport

                    }
                });
            }
            else
            {
                final ClientTransport newTransport = negotiatedTransports.get(0);
                updateBayeuxClientState(new BayeuxClientStateUpdater()
                {
                    public BayeuxClientState create(BayeuxClientState oldState)
                    {
                        if (newTransport != oldState.transport)
View Full Code Here

Examples of org.cometd.client.transport.ClientTransport

    {
        options.put(qualifiedName, value);
        // Forward the option to the transports.
        for (String name : transportRegistry.getKnownTransports())
        {
            ClientTransport transport = transportRegistry.getTransport(name);
            transport.setOption(qualifiedName, value);
        }
    }
View Full Code Here

Examples of org.cometd.client.transport.ClientTransport

                    }
                });
            }
            else
            {
                final ClientTransport newTransport = transports.get(0);
                updateBayeuxClientState(new BayeuxClientStateUpdater()
                {
                    @Override
                    public BayeuxClientState create(BayeuxClientState oldState)
                    {
                        if (newTransport != oldState.transport)
                            prepareTransport(oldState.transport, newTransport);
                        onTransportFailure(oldState.transport.getName(), newTransport.getName(), failure);
                        return new RehandshakingState(oldState.handshakeFields, oldState.callback, newTransport, oldState.nextBackoff());
                    }
                });
            }
            super.onFailure(failure, messages);
View Full Code Here

Examples of org.cometd.client.transport.ClientTransport

  public void init() throws Exception {
    // Prepare the HTTP transport
    HttpClient httpClient = new HttpClient();
    httpClient.start();
    ClientTransport  httpTransport = new LongPollingTransport(null, httpClient);

    // Configure the BayeuxClient, with the websocket transport listed before the http transport
    BayeuxClient client = new BayeuxClient("http://localhost:8080/cometd", httpTransport);

    // Handshake
View Full Code Here

Examples of org.cometd.client.transport.ClientTransport

    {
        final HttpClient httpClient = new HttpClient();
        httpClient.start();

        final Map<String, Object> options = new HashMap<String, Object>();
        final ClientTransport transport = LongPollingTransport.create(options, httpClient);

        final BayeuxClient client = new BayeuxClient("http://localhost:8090/ajax/cometd", transport);

        client.handshake();
        final boolean handshaken = client.waitFor(1000, BayeuxClient.State.CONNECTED);
View Full Code Here

Examples of org.objectweb.celtix.transports.ClientTransport

     */
    private void clientResend(ObjectMessageContext context) throws IOException {
        Request request = createClientRequest(context);
        OutputStreamMessageContext outputStreamContext =
            request.process(null, true, true);
        ClientTransport transport = handler.getClientTransport();
        if (transport != null) {
            // decoupled response channel always being used with RM,
            // hence a partial response must be processed
            invokePartial(request, transport, outputStreamContext);
        } else {
View Full Code Here

Examples of org.objectweb.celtix.transports.ClientTransport

        clientBinding.createResponseCallback();
        EasyMock.expectLastCall().andReturn(responseCallback);
       
        EasyMock.replay(clientBinding);
       
        ClientTransport ct = factory.createClientTransport(endpointRef, clientBinding);
        assertNotNull("server transport must not be null", ct);
        assertSame("transport must JBIClientTransport", JBIClientTransport.class, ct.getClass());
        EasyMock.verify(clientBinding);
   
    }
View Full Code Here

Examples of org.objectweb.celtix.transports.ClientTransport

                                                       portName, address);
        setupCallbackObject(useAutomaticWorkQueue);

        server.activate(callback);

        ClientTransport client = createClientTransport(factory, wsdlUrl, serviceName, portName);
        assertTrue("targetEndpoint address mismatch. Expected : " + address
                   + "  received : " + client.getTargetEndpoint(),
                   address.equals(client.getTargetEndpoint().getAddress().getValue()));

        OutputStreamMessageContext octx = null;
        byte outBytes[] = "Hello World!!!".getBytes();
        InputStreamMessageContext ictx = doClientInvoke(client, octx, outBytes, false);

        byte bytes[] = new byte[10000];
        int len = ictx.getInputStream().read(bytes);
        assertTrue("Did not read anything " + len, len > 0);
        assertEquals(new String(outBytes), new String(bytes, 0, len));

        //long request
        outBytes = new byte[5000];
        for (int x = 0; x < outBytes.length; x++) {
            outBytes[x] = (byte)('a' + (x % 26));
        }

        ictx = doClientInvoke(client, octx, outBytes, false);
        int total = readBytes(bytes, ictx.getInputStream());

        assertTrue("Did not read anything " + total, total > 0);
        assertEquals(new String(outBytes), new String(bytes, 0, total));

        outBytes = "Hello World!!!".getBytes();

        server.deactivate();

        try {
            ictx = doClientInvoke(client, octx, outBytes, true);
            len = ictx.getInputStream().read(bytes);

            if (len != -1) {
                fail("was able to process a message after the servant was deactivated: " + len
                     + " - " + new String(bytes));
            }
        } catch (IOException ex) {
            //ignore - this is what we want
        }

        server.activate(callback);

        outBytes = "New String and must match with response".getBytes();
        ictx = doClientInvoke(client, octx, outBytes, false);
        len = ictx.getInputStream().read(bytes);
        assertTrue("Did not read anything " + len, len > 0);
        assertEquals(new String(outBytes), new String(bytes, 0, len));
        server.shutdown();
        client.shutdown();
    }
View Full Code Here

Examples of org.objectweb.celtix.transports.ClientTransport

                                                       portName, address);


        server.activate(callback1);

        ClientTransport client = createClientTransport(factory, wsdlUrl, serviceName, portName);
       
        assertTrue("targetEndpoint address mismatch. Expected : " + address
                   + "  received : " + client.getTargetEndpoint(),
                   address.equals(client.getTargetEndpoint().getAddress().getValue()));
        OutputStreamMessageContext octx =
            client.createOutputStreamContext(new GenericMessageContext());
        client.finalPrepareOutputStreamContext(octx);
        byte outBytes[] = "Hello World!!!".getBytes();
        octx.getOutputStream().write(outBytes);
        client.invokeOneway(octx);
        Thread.sleep(500L);
        assertEquals(new String(outBytes),
                          serverRcvdInOneWayCall.substring(0, outBytes.length));

        server.shutdown();
        client.shutdown();
    }
View Full Code Here

Examples of org.objectweb.celtix.transports.ClientTransport

    private ClientTransport createClientTransport(TransportFactory factory, URL wsdlUrl,
                                                  QName serviceName, String portName)
        throws WSDLException, IOException {
        EndpointReferenceType ref = EndpointReferenceUtils
            .getEndpointReference(wsdlUrl, serviceName, portName);
        ClientTransport transport =
            factory.createClientTransport(ref, new TestClientBinding(bus, ref));

        return transport;
    }
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.