use of io.grpc.InternalChannelz.TransportStats in project grpc-java by grpc.
the class OkHttpClientTransportTest method transportTracer_windowSize_remote.
@Test
public void transportTracer_windowSize_remote() throws Exception {
initTransport();
TransportStats before = getTransportStats(clientTransport);
assertEquals(INITIAL_WINDOW_SIZE, before.remoteFlowControlWindow);
// okhttp does not track local window sizes
assertEquals(-1, before.localFlowControlWindow);
frameHandler().windowUpdate(0, 1000);
TransportStats after = getTransportStats(clientTransport);
assertEquals(INITIAL_WINDOW_SIZE + 1000, after.remoteFlowControlWindow);
// okhttp does not track local window sizes
assertEquals(-1, after.localFlowControlWindow);
}
use of io.grpc.InternalChannelz.TransportStats in project grpc-java by grpc.
the class OkHttpClientTransportTest method transportTracer_windowSizeDefault.
@Test
public void transportTracer_windowSizeDefault() throws Exception {
initTransport();
TransportStats stats = getTransportStats(clientTransport);
assertEquals(INITIAL_WINDOW_SIZE, stats.remoteFlowControlWindow);
// okhttp does not track local window sizes
assertEquals(-1, stats.localFlowControlWindow);
}
use of io.grpc.InternalChannelz.TransportStats in project grpc-java by grpc.
the class NettyHandlerTestBase method transportTracer_windowSizeDefault.
@Test
public void transportTracer_windowSizeDefault() throws Exception {
manualSetUp();
TransportStats transportStats = transportTracer.getStats();
assertEquals(Http2CodecUtil.DEFAULT_WINDOW_SIZE, transportStats.remoteFlowControlWindow);
assertEquals(flowControlWindow, transportStats.localFlowControlWindow);
}
use of io.grpc.InternalChannelz.TransportStats in project grpc-java by grpc.
the class NettyHandlerTestBase method transportTracer_windowSize.
@Test
public void transportTracer_windowSize() throws Exception {
flowControlWindow = 1024 * 1024;
manualSetUp();
TransportStats transportStats = transportTracer.getStats();
assertEquals(Http2CodecUtil.DEFAULT_WINDOW_SIZE, transportStats.remoteFlowControlWindow);
assertEquals(flowControlWindow, transportStats.localFlowControlWindow);
}
use of io.grpc.InternalChannelz.TransportStats in project grpc-java by grpc.
the class AbstractTransportTest method transportTracer_server_streamEnded_ok.
@Test
public void transportTracer_server_streamEnded_ok() throws Exception {
server.start(serverListener);
client = newClientTransport(server);
startTransport(client, mockClientTransportListener);
ClientStream clientStream = client.newStream(methodDescriptor, new Metadata(), callOptions, tracers);
ClientStreamListenerBase clientStreamListener = new ClientStreamListenerBase();
clientStream.start(clientStreamListener);
MockServerTransportListener serverTransportListener = serverListener.takeListenerOrFail(TIMEOUT_MS, TimeUnit.MILLISECONDS);
StreamCreation serverStreamCreation = serverTransportListener.takeStreamOrFail(TIMEOUT_MS, TimeUnit.MILLISECONDS);
ServerStream serverStream = serverStreamCreation.stream;
if (!haveTransportTracer()) {
return;
}
TransportStats serverBefore = getTransportStats(serverTransportListener.transport);
assertEquals(0, serverBefore.streamsSucceeded);
assertEquals(0, serverBefore.streamsFailed);
TransportStats clientBefore = getTransportStats(client);
assertEquals(0, clientBefore.streamsSucceeded);
assertEquals(0, clientBefore.streamsFailed);
clientStream.halfClose();
serverStream.close(Status.OK, new Metadata());
// do not validate stats until close() has been called on client
assertNotNull(clientStreamListener.status.get(TIMEOUT_MS, TimeUnit.MILLISECONDS));
assertNotNull(clientStreamListener.trailers.get(TIMEOUT_MS, TimeUnit.MILLISECONDS));
TransportStats serverAfter = getTransportStats(serverTransportListener.transport);
assertEquals(1, serverAfter.streamsSucceeded);
assertEquals(0, serverAfter.streamsFailed);
TransportStats clientAfter = getTransportStats(client);
assertEquals(1, clientAfter.streamsSucceeded);
assertEquals(0, clientAfter.streamsFailed);
}
Aggregations