RpcStreamConnection extends RpcConnection { public long putRpcPackets(@Nonnull RpcPacket[] packets) throws ConnectionException { Validate.notNull(packets); int retVal = 0; for (RpcPacket packet : packets) { if (nonNull(packet)) { retVal += putRpcPacket(packet); } } return retVal; } RpcStreamConnection(String serverHost, int serverPort, Properties props,
            ServerStats stats, Charset charset);  RpcStreamConnection(String serverHost, int serverPort, Properties props,
            ServerStats stats, Charset charset, boolean secure);  RpcStreamConnection(String serverHost, int serverPort, Properties props,
            ServerStats stats, Charset charset, Socket socket);  RpcStreamConnection(String serverHost, int serverPort, Properties props,
            ServerStats stats, Charset charset, RpcSocketPool pool);  RpcStreamConnection(String serverHost, int serverPort, Properties props,
            ServerStats stats, Charset charset, Socket socket, boolean secure);  RpcStreamConnection(String serverHost, int serverPort, Properties props,
            ServerStats stats, Charset charset, RpcSocketPool pool, boolean secure);  RpcStreamConnection(String serverHost, int serverPort, Properties props,
            ServerStats stats, Charset charset, Socket socket, RpcSocketPool pool, boolean secure);  RpcStreamConnection(String serverHost, int serverPort, Properties props,
            ServerStats stats, Charset charset, 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 putRpcPackets_null_rpcPackets() throws Exception { expectThrows(NullPointerException.class, () -> mockConnection.putRpcPackets(null)); }
@Test public void putRpcPackets_empty_rpcPackets() throws Exception { long retVal = mockConnection.putRpcPackets(new RpcPacket[0]); assertThat(retVal, is(0L)); }
@Test public void putRpcPackets_size_equal_2_rpcPackets_() throws Exception { RpcPacket rpcPacket1 = mock(RpcPacket.class); when(rpcPacket1.getFuncNameString()).thenReturn("add"); RpcPacket rpcPacket2 = mock(RpcPacket.class); when(rpcPacket2.getFuncNameString()).thenReturn("sync"); RpcPacket[] rpcPackets = new RpcPacket[] { rpcPacket1, rpcPacket2 }; long retVal = mockConnection.putRpcPackets(rpcPackets); assertThat(retVal, is(0L)); verify(rpcPacket1, times(2)).getFuncNameString(); verify(rpcPacket2, times(2)).getFuncNameString(); verify(rpcPacket1).getMapArgs(); verify(rpcPacket1).getStrArgs(); verify(rpcPacket1).getEnv(); }