@Override
	void serveBlockStream(Socket socket, BlockStream blockStream) throws IOException {
		if (!(blockStream instanceof InputBlockStream)) {
			throw new IllegalArgumentException("expected InputBlockStream");
		}

		socket.setSendBufferSize(getPreferredBufferSize());

		InputBlockStream inputBlockStream = (InputBlockStream) blockStream;
		try (OutputStream out = socket.getOutputStream()) {

			copyBlockData(inputBlockStream, out);

			// perform final handshake before close (uncompressed)
			writeStreamEnd(socket);
			readStreamEnd(socket, false);
		}
		catch (SocketException e) {
			// remain silent if socket closed by client
			if (e.getMessage().startsWith("Broken pipe")) {
				throw new EOFException("unexpected end of stream");
			}
			throw e;
		}
	}
<code>ClientInputBlockStream</code> provides the client-side of an
InputBlockStream which wraps an optionally compressed socket input stream
Ghidra/Features/GhidraServer/src/main/java/ghidra/server/stream/RemoteInputBlockStreamHandle.java