Examples of FramedClientConnector


Examples of com.facebook.nifty.client.FramedClientConnector

    private ListenableFuture<? extends ClientInterface> createClient(ThriftClientManager clientManager)
            throws TTransportException, InterruptedException, ExecutionException
    {
        HostAndPort address = HostAndPort.fromParts("localhost", server.getPort());
        return clientManager.createClient(new FramedClientConnector(address), clientClass);
    }
View Full Code Here

Examples of com.facebook.nifty.client.FramedClientConnector

        // create server and client
        try (
                ThriftServer server = new ThriftServer(processor).start();
                ThriftClientManager clientManager = new ThriftClientManager();
                PumaReadService pumaClient = clientManager.createClient(
                        new FramedClientConnector(fromParts("localhost", server.getPort())),
                        PumaReadService.class).get()
        ) {
            // invoke puma
            List<ReadResultQueryInfoTimeString> results = pumaClient.getResultTimeString(PUMA_REQUEST);
            verifyPumaResults(results);
View Full Code Here

Examples of com.facebook.nifty.client.FramedClientConnector

        TProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), puma);
        try (
                ThriftServer server = new ThriftServer(processor).start();
                ThriftClientManager clientManager = new ThriftClientManager();
                PumaReadService pumaClient = clientManager.createClient(
                        new FramedClientConnector(HostAndPort.fromParts("localhost", server.getPort())),
                        PumaReadService.class).get()
        ) {
            pumaClient.getResultTimeString(PUMA_REQUEST);
            fail("Expected ReadSemanticException");
        }
View Full Code Here

Examples of com.facebook.nifty.client.FramedClientConnector

    {
        HostAndPort address = HostAndPort.fromParts("localhost", serverPort);
        ThriftClientConfig config = new ThriftClientConfig().setConnectTimeout(new Duration(1, TimeUnit.SECONDS))
                                                            .setReadTimeout(new Duration(1, TimeUnit.SECONDS))
                                                            .setWriteTimeout(new Duration(1, TimeUnit.SECONDS));
        FramedClientConnector connector = new FramedClientConnector(address);
        return new ThriftClient<>(clientManager, clientClass, config, "asyncTestClient").open(connector);
    }
View Full Code Here

Examples of com.facebook.nifty.client.FramedClientConnector

    protected void shutDown() throws Exception {
        niftyClient.close();
    }

    public T newClient(final InetSocketAddress inetSocketAddress) throws TTransportException, InterruptedException {
        final FramedClientConnector framedClientConnector = new FramedClientConnector(inetSocketAddress);
        final TProtocol protocol = protocolFactory.getProtocol(niftyClient.connectSync(type, framedClientConnector));
        return serviceClientFactory.getClient(protocol);
    }
View Full Code Here

Examples of com.facebook.nifty.client.FramedClientConnector

        final TProtocol protocol = protocolFactory.getProtocol(niftyClient.connectSync(type, framedClientConnector));
        return serviceClientFactory.getClient(protocol);
    }

    public T newClient(final HostAndPort hostAndPort) throws TTransportException, InterruptedException {
        final FramedClientConnector framedClientConnector = new FramedClientConnector(hostAndPort);
        final TProtocol protocol = protocolFactory.getProtocol(niftyClient.connectSync(type, framedClientConnector));
        return serviceClientFactory.getClient(protocol);
    }
View Full Code Here

Examples of com.facebook.nifty.client.FramedClientConnector

        niftyClient.close();
    }

    public T newClient(final InetSocketAddress inetSocketAddress) throws TTransportException, InterruptedException {
        final TDuplexProtocolFactory duplexProtocolFactory = TDuplexProtocolFactory.fromSingleFactory(protocolFactory);
        final FramedClientConnector framedClientConnector = new FramedClientConnector(inetSocketAddress, duplexProtocolFactory);
        final TProtocol protocol = protocolFactory.getProtocol(niftyClient.connectSync(type, framedClientConnector));
        return serviceClientFactory.getClient(protocol);
    }
View Full Code Here

Examples of com.facebook.nifty.client.FramedClientConnector

        return serviceClientFactory.getClient(protocol);
    }

    public T newClient(final HostAndPort hostAndPort) throws TTransportException, InterruptedException {
        final TDuplexProtocolFactory duplexProtocolFactory = TDuplexProtocolFactory.fromSingleFactory(protocolFactory);
        final FramedClientConnector framedClientConnector = new FramedClientConnector(hostAndPort, duplexProtocolFactory);
        final TProtocol protocol = protocolFactory.getProtocol(niftyClient.connectSync(type, framedClientConnector));
        return serviceClientFactory.getClient(protocol);
    }
View Full Code Here

Examples of com.facebook.nifty.client.FramedClientConnector

        pool = new GenericKeyedObjectPool<>(new BaseKeyedPooledObjectFactory<InetSocketAddress, TNiftyClientChannelTransport>() {
            @Override
            public TNiftyClientChannelTransport create(InetSocketAddress key) throws Exception {
                log.debug("Connecting to {}", key);
                final FramedClientConnector connector = new FramedClientConnector(key, duplexProtocolFactory);
                final TNiftyClientChannelTransport transport =
                    config.niftyClient.connectSync(
                            config.clientClass,
                            connector,
                            config.connectTimeout,
View Full Code Here

Examples of com.facebook.nifty.client.FramedClientConnector

                            TypeLiteral<NiftyClientConnector<? extends NiftyClientChannel>> channelConnectorType =
                                    new TypeLiteral<NiftyClientConnector<? extends NiftyClientChannel>>() {};
                            NiftyClientConnector<? extends NiftyClientChannel> connector;
                            switch (config.transport) {
                                case FRAMED:
                                    connector = new FramedClientConnector(HostAndPort.fromParts(config.serverAddress, config.serverPort));
                                    break;
                                case UNFRAMED:
                                    connector = new UnframedClientConnector(HostAndPort.fromParts(config.serverAddress, config.serverPort));
                                    break;
                                default:
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.