use of org.apache.thrift.server.TSimpleServer in project commons by twitter.
the class PingPongServer method run.
@Override
public void run() {
PingPongHandler handler = new PingPongHandler();
PingPong.Processor processor = new PingPong.Processor(handler);
TServer server;
try {
TServerTransport transport = new TServerSocket(THRIFT_PORT.get());
server = new TSimpleServer(processor, transport);
} catch (TTransportException e) {
throw new RuntimeException(e);
}
LOG.info("Starting thrift server.");
server.serve();
}
use of org.apache.thrift.server.TSimpleServer in project providence by morimekta.
the class SocketClientHandlerTest method setUpServer.
@BeforeClass
public static void setUpServer() throws Exception {
Awaitility.setDefaultPollDelay(2, TimeUnit.MILLISECONDS);
impl = Mockito.mock(Iface.class);
TServerSocket transport = new TServerSocket(0);
server = new TSimpleServer(new TServer.Args(transport).protocolFactory(new TBinaryProtocol.Factory()).processor(new Processor<>(impl)));
executor = Executors.newSingleThreadExecutor();
executor.submit(server::serve);
serializer = new BinarySerializer();
port = transport.getServerSocket().getLocalPort();
address = new InetSocketAddress("localhost", port);
}
Aggregations