Examples of FramedClientConnector


Examples of com.facebook.nifty.client.FramedClientConnector

        }
    }

    public T newClient(final InetSocketAddress inetSocketAddress) throws TTransportException, InterruptedException {
        final TDuplexProtocolFactory duplexProtocolFactory = TDuplexProtocolFactory.fromSingleFactory(configuration.protocolFactory);
        final FramedClientConnector framedClientConnector = new FramedClientConnector(inetSocketAddress, duplexProtocolFactory);
        final TProtocol protocol = configuration.protocolFactory.getProtocol(niftyClient.connectSync(configuration.clientType, framedClientConnector));
        return configuration.clientFactory.getClient(protocol);
    }
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

        NiftyProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), ImmutableList.<ThriftEventHandler>of(), 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

            throws Exception
    {
        try (
                ThriftClientManager clientManager = new ThriftClientManager();
                Scribe scribe = clientManager.createClient(
                        new FramedClientConnector(fromParts("localhost", port)),
                        Scribe.class).get()
        ) {
            return scribe.log(entries);
        }
    }
View Full Code Here

Examples of com.facebook.nifty.client.FramedClientConnector

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

Examples of com.facebook.nifty.client.FramedClientConnector

    private final DelayedMap.AsyncClient asyncClient;

    public DelayedMapAsyncProxyHandler(ThriftClientManager clientManager, ThriftServer targetServer)
            throws ExecutionException, InterruptedException
    {
        FramedClientConnector connector = new FramedClientConnector(HostAndPort.fromParts("localhost", targetServer.getPort()));
        asyncClient = clientManager.createClient(connector, DelayedMap.AsyncClient.class).get();
    }
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) {
            @Override
            public FramedClientChannel newThriftClientChannel(
                    Channel nettyChannel, Timer timer)
            {
                if (connectDelay.toMillis() > 0) {
View Full Code Here

Examples of com.facebook.nifty.client.FramedClientConnector

    {
        ThriftClientConfig config = new ThriftClientConfig().setConnectTimeout(Duration.valueOf("1s"))
                                                            .setReadTimeout(Duration.valueOf("1s"))
                                                            .setWriteTimeout(Duration.valueOf("1s"));
        ThriftClient<Scribe> thriftClient = new ThriftClient<>(manager, Scribe.class, config, "ScribeClient");
        return thriftClient.open(new FramedClientConnector(HostAndPort.fromParts("localhost", server.getPort()),
                                                           TDuplexProtocolFactory.fromSingleFactory(protocolFactory))).get();
    }
View Full Code Here

Examples of com.facebook.nifty.client.FramedClientConnector

        assertEquals(pumaClient.getMaxFrameSize(), ThriftClientConfig.DEFAULT_MAX_FRAME_SIZE);
        assertEquals(HostAndPort.fromString(pumaClient.getSocksProxy()), proxy);
    }

    private NiftyClientConnector<? extends NiftyClientChannel> localFramedConnector(int port) {
        return new FramedClientConnector(HostAndPort.fromParts("localhost", port));
    }
View Full Code Here

Examples of com.facebook.nifty.client.FramedClientConnector

            throws Exception
    {
        try (
                ThriftClientManager clientManager = new ThriftClientManager();
                Scribe scribe = clientManager.createClient(
                        new FramedClientConnector(fromParts("localhost", port)),
                        Scribe.class).get()
        ) {
            return scribe.log(entries);
        }
    }
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.