NetworkProfilerStage extends StreamingStage implements CodeNavigator.Listener { @NotNull public NetworkConnectionsModel getConnectionsModel() { return myConnectionsModel; } NetworkProfilerStage(StudioProfilers profilers); boolean hasUserUsedNetworkSelection(); @NotNull NetworkConnectionsModel getConnectionsModel(); @NotNull RangeSelectionModel getRangeSelectionModel(); @NotNull StackTraceModel getStackTraceModel(); @NotNull HttpDataFetcher getHttpDataFetcher(); boolean setSelectedConnection(@Nullable HttpData data); @Nullable HttpData getSelectedConnection(); @NotNull AspectModel<NetworkProfilerAspect> getAspect(); @Override void enter(); @Override void exit(); @NotNull String getName(); @NotNull DetailedNetworkUsage getDetailedNetworkUsage(); @NotNull AxisComponentModel getTrafficAxis(); @NotNull AxisComponentModel getConnectionsAxis(); @NotNull NetworkStageLegends getLegends(); @NotNull NetworkStageLegends getTooltipLegends(); @NotNull EaseOutModel getInstructionsEaseOutModel(); @NotNull EventMonitor getEventMonitor(); @Override void onNavigated(@NotNull CodeLocation location);  }
@Test public void getConnectionsModel() { String dummyPayloadContent = "Dummy Contents"; myTransportService.addFile(TEST_PAYLOAD_ID, ByteString.copyFromUtf8(dummyPayloadContent)); NetworkConnectionsModel connectionsModel = myStage.getConnectionsModel(); List<HttpData> dataList = connectionsModel.getData(new Range(TimeUnit.SECONDS.toMicros(0), TimeUnit.SECONDS.toMicros(16))); assertThat(dataList).hasSize(1); HttpData data = dataList.get(0); HttpData expectedData = FAKE_HTTP_DATA.get(0); assertThat(data.getRequestStartTimeUs()).isEqualTo(expectedData.getRequestStartTimeUs()); assertThat(data.getRequestCompleteTimeUs()).isEqualTo(expectedData.getRequestCompleteTimeUs()); assertThat(data.getResponseStartTimeUs()).isEqualTo(expectedData.getResponseStartTimeUs()); assertThat(data.getResponseCompleteTimeUs()).isEqualTo(expectedData.getResponseCompleteTimeUs()); assertThat(data.getConnectionEndTimeUs()).isEqualTo(expectedData.getConnectionEndTimeUs()); assertThat(data.getMethod()).isEqualTo(expectedData.getMethod()); assertThat(data.getUrl()).isEqualTo(expectedData.getUrl()); assertThat(data.getTrace()).isEqualTo(expectedData.getTrace()); assertThat(data.getRequestPayloadId()).isEqualTo(expectedData.getRequestPayloadId()); assertThat(data.getResponsePayloadId()).isEqualTo(expectedData.getResponsePayloadId()); assertThat(data.getResponseHeader().getField("connId")).isEqualTo(expectedData.getResponseHeader().getField("connId")); assertThat(Payload.newRequestPayload(connectionsModel, data).getBytes()) .isEqualTo(Payload.newRequestPayload(connectionsModel, data).getBytes()); assertThat(Payload.newResponsePayload(connectionsModel, data).getBytes()) .isEqualTo(Payload.newResponsePayload(connectionsModel, data).getBytes()); }