Package com.facebook.nifty.client

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


        int port = serverSocket.getLocalPort();

        final NiftyClient client = new NiftyClient();
        try {
            ListenableFuture<FramedClientChannel> future =
                            client.connectAsync(new FramedClientConnector(new InetSocketAddress(port)),
                                                TEST_CONNECT_TIMEOUT,
                                                TEST_READ_TIMEOUT,
                                                TEST_WRITE_TIMEOUT);
            // Wait while NiftyClient attempts to connect the channel
            future.get();
View Full Code Here

        int port = serverSocket.getLocalPort();

        final NiftyClient client = new NiftyClient();
        try {
            ListenableFuture<FramedClientChannel> future =
                            client.connectAsync(new FramedClientConnector(new InetSocketAddress(port)),
                                                TEST_CONNECT_TIMEOUT,
                                                TEST_READ_TIMEOUT,
                                                TEST_WRITE_TIMEOUT,
                                                TEST_MAX_FRAME_SIZE);
            // Wait while NiftyClient attempts to connect the channel
View Full Code Here

        while (client == null) {
            try {
                final HostAndPort hostAndPort = getNextHostAndPort();
                final NiftyClientConnector<? extends NiftyClientChannel> clientConnector = config.isFramed()
                    ? new FramedClientConnector(hostAndPort)
                    : new UnframedClientConnector(hostAndPort);

                client = thriftClient.open(clientConnector).get();
                if (!clientHolder.compareAndSet(null, client)) {
                    client.close();
View Full Code Here

    {
        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

    private scribe.Client makeNiftyClient()
            throws TTransportException, InterruptedException
    {
        InetSocketAddress address = new InetSocketAddress("localhost", port);
        TTransport transport = new NiftyClient().connectSync(scribe.Client.class, new FramedClientConnector(address));
        TBinaryProtocol tp = new TBinaryProtocol(transport);
        return new scribe.Client(tp);
    }
View Full Code Here

        ServerSocket serverSocket = new ServerSocket(0);
        int port = serverSocket.getLocalPort();
        final NiftyClient client = new NiftyClient();
        try {
                client.connectSync(scribe.Client.class,
                                   new FramedClientConnector(new InetSocketAddress(port)),
                                   TEST_CONNECT_TIMEOUT,
                                   TEST_RECEIVE_TIMEOUT,
                                   TEST_READ_TIMEOUT,
                                   TEST_SEND_TIMEOUT,
                                   TEST_MAX_FRAME_SIZE);
View Full Code Here

        int port = serverSocket.getLocalPort();

        final NiftyClient client = new NiftyClient();
        try {
            ListenableFuture<FramedClientChannel> future =
                            client.connectAsync(new FramedClientConnector(new InetSocketAddress(port)),
                                                TEST_CONNECT_TIMEOUT,
                                                TEST_RECEIVE_TIMEOUT,
                                                TEST_READ_TIMEOUT,
                                                TEST_SEND_TIMEOUT,
                                                TEST_MAX_FRAME_SIZE);
View Full Code Here

            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

        HostAndPort address = HostAndPort.fromParts("localhost", serverPort);
        ThriftClientConfig config = new ThriftClientConfig().setConnectTimeout(new Duration(1, TimeUnit.SECONDS))
                                                            .setReceiveTimeout(new Duration(10, 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

TOP

Related Classes of com.facebook.nifty.client.FramedClientConnector

Copyright © 2018 www.massapicom. 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.