RpcStreamConnection extends RpcConnection { void processExternalEnv(@Nonnull RpcPacket packet, @Nonnull final RpcPacketSupplier argsSupplier) { ExternalEnv externalEnv = packet.getEnv(); if (nonNull(externalEnv)) { reallocateSendBufferInPutPacketIfRunOut(argsSupplier, externalEnv.marshal(), SENDBUF_REALLOC_INCR); } } 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 processExternalEnv() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { ExternalEnv externalEnv = mock(ExternalEnv.class); byte[] sendBytes = new byte[] { 'd', 'e', 'f' }; when(externalEnv.marshal()).thenReturn(sendBytes); RpcPacket packet = RpcPacket.constructRpcPacket("test", null, externalEnv); RpcStreamConnection.RpcPacketSupplier supplier = createMockRpcPacketSupplier(); mockConnection.processExternalEnv(packet, supplier); verifyMockRpcPacketSupplier(supplier, 1); }