@Override
    public <T extends Response> CompletableFuture<T> sendAsync(
            Request request, Class<T> responseType) {

        CompletableFuture<T> result = new CompletableFuture<>();
        long requestId = request.getId();
        requestForId.put(requestId, new WebSocketRequest<>(result, responseType));
        try {
            sendRequest(request, requestId);
        } catch (IOException e) {
            closeRequest(requestId, e);
        }

        return result;
    }
@Test
    public void testReceiveReply() throws Exception {
        CompletableFuture<Web3ClientVersion> reply =
                service.sendAsync(request, Web3ClientVersion.class);
        sendGethVersionReply();

        assertTrue(reply.isDone());
        assertEquals("geth-version", reply.get().getWeb3ClientVersion());
    }