Example #1
0
 private void startServer(final ThriftServerDefBuilder thriftServerDefBuilder) {
   server =
       new NettyServerTransport(
           thriftServerDefBuilder.build(),
           NettyServerConfig.newBuilder().build(),
           new DefaultChannelGroup());
   server.start();
   port = ((InetSocketAddress) server.getServerChannel().getLocalAddress()).getPort();
 }
    public ScopedServer(TProtocolFactory protocolFactory)
        throws TTransportException, InterruptedException {
      ThriftServiceProcessor processor =
          new ThriftServiceProcessor(
              new ThriftCodecManager(),
              ImmutableList.<ThriftEventHandler>of(),
              new ScribeHandler());

      ThriftServerDef def =
          ThriftServerDef.newBuilder()
              .listen(0)
              .withProcessor(processor)
              .protocol(protocolFactory)
              .build();

      server =
          new NettyServerTransport(
              def, NettyServerConfig.newBuilder().build(), new DefaultChannelGroup());
      server.start();
    }