@Override
    public String read() throws IOException {
        CharBuffer response = CharBuffer.allocate(bufferSize);
        StringBuilder result = new StringBuilder();

        do {
            response.clear();
            reader.read(response);
            result.append(response.array(), response.arrayOffset(), response.position());
        } while (response.get(response.position() - 1) != '\n');

        return result.toString();
    }
@Test
    public void testIpcService() throws IOException {
        unixDomainSocket = new UnixDomainSocket(reader, writer, RESPONSE.length());

        doAnswer(
                        invocation -> {
                            Object[] args = invocation.getArguments();
                            ((CharBuffer) args[0]).append(RESPONSE);
                            return RESPONSE.length(); // void method, so return null
                        })
                .when(reader)
                .read(any(CharBuffer.class));

        runTest();
    }