class RpcStreamConnection extends RpcConnection {

    public void disconnect(final RpcPacketDispatcher dispatcher) throws ConnectionException {
        try {
            // NOTE: don't do gratuitous (any) flushes here -- this has all been
            // handled already and will often cause errors in compressed client
            // connection setups -- HR.
            ShutdownHandler handler = new ShutdownHandler() {
                @Override
                public void shutdown(Socket theSocket) {
                    if (nonNull(dispatcher)) {
                        try {
                            dispatcher.shutdown(RpcStreamConnection.this);
                        } catch (ConnectionException e) {
                            Log.exception(e);
                        }
                    }
                }
            };
            // Handle 'rsh' mode server shutdown
            if (isNotBlank(rsh)) {
                try {
                    dispatcher.shutdown(RpcStreamConnection.this);
                } catch (ConnectionException e) {
                    Log.exception(e);
                }
                topInputStream.close();
                topOutputStream.close();
            } else {
                if (nonNull(pool)) {
                    pool.release(socket, handler);
                } else {
                    handler.shutdown(socket);
                    topInputStream.close();
                    topOutputStream.close();
                    if (nonNull(socket)) {
                        socket.close();
                    }
                }
            }
        } catch (IOException exc) {
            throwConnectionException(exc, "RPC disconnection error: %s", exc.getLocalizedMessage());
        }
    }

    public  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);
    public  RpcStreamConnection(String serverHost, int serverPort, Properties props,
            ServerStats stats, P4Charset p4Charset, Socket socket, RpcSocketPool pool, boolean secure,
            String rsh);

}