Package echo

Source Code of echo.EchoServer

package echo;

import com.google.protobuf.RpcCallback;
import com.google.protobuf.RpcController;

import echo.EchoProto.EchoRequest;
import echo.EchoProto.EchoResponse;
import echo.EchoProto.EchoService.Interface;
import muduo.rpc.RpcServer;

public class EchoServer {

    public static void main(String[] args) {
        RpcServer server = new RpcServer();
        server.registerService(EchoProto.EchoService.newReflectiveService(new Interface() {
            @Override
            public void echo(RpcController controller, EchoRequest request, RpcCallback<EchoResponse> done) {
                done.run(EchoResponse.newBuilder().setPayload(request.getPayload()).build());
            }
        }));
        server.start(8888);
    }
}
TOP

Related Classes of echo.EchoServer

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.