### Question:
NettyServerCnxn extends ServerCnxn { @Override protected ServerStats serverStats() { if (zkServer == null) { return null; } return zkServer.serverStats(); } NettyServerCnxn(Channel channel, ZooKeeperServer zks, NettyServerCnxnFactory factory); @Override void close(DisconnectReason reason); void close(); @Override long getSessionId(); @Override int getSessionTimeout(); @Override void process(WatchedEvent event); @Override int sendResponse(ReplyHeader h, Record r, String tag,
                             String cacheKey, Stat stat, int opCode); @Override void setSessionId(long sessionId); @Override void sendBuffer(ByteBuffer... buffers); @Override void disableRecv(boolean waitDisableRecv); @Override void enableRecv(); @Override void setSessionTimeout(int sessionTimeout); @Override int getInterestOps(); @Override InetSocketAddress getRemoteSocketAddress(); @Override void sendCloseSession(); @Override boolean isSecure(); @Override Certificate[] getClientCertificateChain(); @Override void setClientCertificateChain(Certificate[] chain); int getQueuedReadableBytes(); void setHandshakeState(HandshakeState state); HandshakeState getHandshakeState(); public int readIssuedAfterReadComplete; }### Answer:
@Test public void testClientResponseStatsUpdate() throws IOException, InterruptedException, KeeperException { try (ZooKeeper zk = createClient()) { BufferStats clientResponseStats = serverFactory.getZooKeeperServer().serverStats().getClientResponseStats(); assertThat("Last client response size should be initialized with INIT_VALUE", clientResponseStats.getLastBufferSize(), equalTo(BufferStats.INIT_VALUE)); zk.create("/a", "test".getBytes(StandardCharsets.UTF_8), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); assertThat("Last client response size should be greater than 0 after client request was performed", clientResponseStats.getLastBufferSize(), greaterThan(0)); byte[] contents = zk.getData("/a", null, null); assertArrayEquals("test".getBytes(StandardCharsets.UTF_8), contents, "unexpected data"); } }