### Question:
ChannelzProtoUtil { static SocketData extractSocketData(SocketStats socketStats) { SocketData.Builder builder = SocketData.newBuilder(); if (socketStats.data != null) { TransportStats s = socketStats.data; builder .setStreamsStarted(s.streamsStarted) .setStreamsSucceeded(s.streamsSucceeded) .setStreamsFailed(s.streamsFailed) .setMessagesSent(s.messagesSent) .setMessagesReceived(s.messagesReceived) .setKeepAlivesSent(s.keepAlivesSent) .setLastLocalStreamCreatedTimestamp( Timestamps.fromNanos(s.lastLocalStreamCreatedTimeNanos)) .setLastRemoteStreamCreatedTimestamp( Timestamps.fromNanos(s.lastRemoteStreamCreatedTimeNanos)) .setLastMessageSentTimestamp( Timestamps.fromNanos(s.lastMessageSentTimeNanos)) .setLastMessageReceivedTimestamp( Timestamps.fromNanos(s.lastMessageReceivedTimeNanos)) .setLocalFlowControlWindow( Int64Value.of(s.localFlowControlWindow)) .setRemoteFlowControlWindow( Int64Value.of(s.remoteFlowControlWindow)); } builder.addAllOption(toSocketOptionsList(socketStats.socketOptions)); return builder.build(); } private  ChannelzProtoUtil();  static final String SO_LINGER; static final String SO_TIMEOUT; static final String TCP_INFO; }### Answer:
@Test public void extractSocketData() throws Exception { assertEquals( socketDataWithDataNoSockOpts, ChannelzProtoUtil.extractSocketData(socket.getStats().get())); socket.socketOptions = toBuilder(socket.socketOptions) .setSocketOptionLingerSeconds(10) .setTcpInfo(channelzTcpInfo) .build(); assertEquals( socketDataWithDataNoSockOpts .toBuilder() .addOption(sockOptlinger10s) .addOption(socketOptionTcpInfo) .build(), ChannelzProtoUtil.extractSocketData(socket.getStats().get())); }
@Test public void toSocketData() throws Exception { assertEquals( socketDataWithDataNoSockOpts .toBuilder() .build(), ChannelzProtoUtil.extractSocketData(socket.getStats().get())); }