Package muduo.rpc

Examples of muduo.rpc.RpcClient


import com.google.protobuf.RpcCallback;

public class Client {

    private static void blockingConnect(InetSocketAddress addr) throws Exception {
        RpcClient client = new RpcClient();
        RpcChannel channel = client.blockingConnect(addr);
        //sendRequest(channel, client);
        BlockingInterface remoteService = Sudoku.SudokuService.newBlockingStub(channel);
        SudokuRequest request = SudokuRequest.newBuilder().setCheckerboard("001010").build();
        SudokuResponse response = remoteService.solve(null, request);
        System.out.println(response);
        channel.disconnect();
        client.stop();
    }
View Full Code Here


        client.stop();
    }

    @SuppressWarnings("unused")
    private static void asyncConnect(InetSocketAddress addr) {
        final RpcClient client = new RpcClient();
        client.registerService(Sudoku.SudokuService.newReflectiveService(new SudokuImpl()));
        client.startConnect(addr, new NewChannelCallback() {
            @Override
            public void run(RpcChannel channel) {
                sendAsyncRequest(channel, client);
            }
        });
View Full Code Here

        }

        @Override
        public void run() {
            System.out.println(Thread.currentThread());
            RpcClient client = new RpcClient(channelFactory);
            RpcChannel channel = client.blockingConnect(serverAddr);
            BlockingInterface remoteService = EchoService.newBlockingStub(channel);
            String payload = new String(new byte[100]);
            payload = "Hello";
            EchoRequest request = EchoRequest.newBuilder().setPayload(payload).build();
View Full Code Here

        private String payload;
        private int nPipelines = 1;
        private int count = 0;

        public AsyncClient(ChannelFactory channelFactory, SocketAddress server) {
            this.client = new RpcClient(channelFactory);
            this.serverAddr = server;

            payload = new String(new byte[100]);
            // payload = "Hello";
            request = EchoRequest.newBuilder().setPayload(payload).build();
View Full Code Here

TOP

Related Classes of muduo.rpc.RpcClient

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.