RpcStreamConnection extends RpcConnection { public int getSystemSendBufferSize() { if (nonNull(socket)) { try { return socket.getSendBufferSize(); } catch (SocketException exc) { Log.error("unexpected exception: %s", exc.getLocalizedMessage()); Log.exception(exc); } } return 0; } RpcStreamConnection(String serverHost, int serverPort, Properties props,
                               ServerStats stats, P4Charset p4Charset, boolean secure); private  RpcStreamConnection(String serverHost, int serverPort, Properties props,
            ServerStats stats, P4Charset p4Charset, Socket socket, boolean secure); private  RpcStreamConnection(String serverHost, int serverPort, Properties props,
            ServerStats stats, P4Charset p4Charset, Socket socket, RpcSocketPool pool, boolean secure);  RpcStreamConnection(String serverHost, int serverPort, Properties props,
            ServerStats stats, P4Charset p4Charset, Socket socket, RpcSocketPool pool, boolean secure,
            String rsh); String getServerIpPort(); String getClientIpPort(); void disconnect(final RpcPacketDispatcher dispatcher); RpcPacket getRpcPacket(); RpcPacket getRpcPacket(final RpcPacketFieldRule fieldRule,
            final IFilterCallback filterCallback); int getSystemRecvBufferSize(); int getSystemSendBufferSize(); long putRpcPackets(@Nonnull RpcPacket[] packets); long putRpcPacket(@Nonnull RpcPacket packet); @Override void useConnectionCompression(); static final String TRACE_PREFIX; }
@Test public void getSystemSendBufferSize() throws Exception { int systemSendBufferSize = mockConnection.getSystemSendBufferSize(); assertThat(systemSendBufferSize, is(socketBufferSize)); }
@Test public void getSystemSendBufferSize_with_exception() throws Exception { reset(socket); doThrow(SocketException.class).when(socket).getSendBufferSize(); int systemSendBufferSize = mockConnection.getSystemSendBufferSize(); assertThat(systemSendBufferSize, is(0)); }