RpcStreamConnection extends RpcConnection { void initRshModeServer() throws ConnectionException { try { String[] command = new String[] { Server.isRunningOnWindows() ? "cmd.exe" : "/bin/sh", Server.isRunningOnWindows() ? "/c" : "-c", rsh }; ProcessBuilder builder = new ProcessBuilder(command); Process process = builder.start(); InputStream in = process.getInputStream(); OutputStream out = process.getOutputStream(); inputStream = new RpcRshInputStream(in, stats); outputStream = new RpcRshOutputStream(out, stats); } catch (Exception thr) { Log.error("Unexpected exception: %s", thr.getLocalizedMessage()); Log.exception(thr); throwConnectionException(thr); } } 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 initRshModeServer() throws ConnectionException { mockConnection.rsh("dir"); mockConnection.initRshModeServer(); }