@Test public void testMultiple() throws IOException, TException, Failure { try (TSocket socket = new TSocket("localhost", port)) { socket.open(); TProtocol protocol = new TBinaryProtocol(socket); Client client = new Client(protocol); AtomicBoolean called = new AtomicBoolean(); when(impl.test(any(Request.class))).thenAnswer(i -> { called.set(true); return Response.builder() .setText("Yay!") .build(); }); net.morimekta.test.thrift.thrift.service.Response response = client.test(new net.morimekta.test.thrift.thrift.service.Request( "Really!")); assertThat(response.getText(), is("Yay!")); waitAtMost(Duration.ONE_HUNDRED_MILLISECONDS).untilTrue(called); called.set(false); verify(impl).test(Request.builder() .setText("Really!") .build()); verify(instrumentation).onComplete(anyDouble(), any(PServiceCall.class), any(PServiceCall.class)); verifyNoMoreInteractions(impl, instrumentation); reset(impl, instrumentation); when(impl.test(any(Request.class))).thenAnswer(i -> { called.set(true); return Response.builder() .setText("Woot!") .build(); }); response = client.test(new net.morimekta.test.thrift.thrift.service.Request( "Doh!")); assertThat(response.getText(), is("Woot!")); verify(impl).test(Request.builder() .setText("Doh!") .build()); waitAtMost(Duration.TWO_HUNDRED_MILLISECONDS).untilTrue(called); verify(instrumentation).onComplete(anyDouble(), any(PServiceCall.class), any(PServiceCall.class)); verifyNoMoreInteractions(impl, instrumentation); } }
public static Builder builder(@Nonnull PProcessor processor) { return new Builder(processor); }
SocketServer implements AutoCloseable { public static Builder builder(@Nonnull PProcessor processor) { return new Builder(processor); } }
SocketServer implements AutoCloseable { public static Builder builder(@Nonnull PProcessor processor) { return new Builder(processor); } private  SocketServer(Builder builder); }
SocketServer implements AutoCloseable { public static Builder builder(@Nonnull PProcessor processor) { return new Builder(processor); } private  SocketServer(Builder builder); static Builder builder(@Nonnull PProcessor processor); int getPort(); @Override void close(); }
SocketServer implements AutoCloseable { public static Builder builder(@Nonnull PProcessor processor) { return new Builder(processor); } private  SocketServer(Builder builder); static Builder builder(@Nonnull PProcessor processor); int getPort(); @Override void close();  }