@Override
    public <T extends Response> T send(Request request, Class<T> responseType) throws IOException {
        try {
            return sendAsync(request, responseType).get();
        } catch (InterruptedException e) {
            Thread.interrupted();
            throw new IOException("Interrupted WebSocket request", e);
        } catch (ExecutionException e) {
            if (e.getCause() instanceof IOException) {
                throw (IOException) e.getCause();
            }

            throw new RuntimeException("Unexpected exception", e.getCause());
        }
    }
@Test
    public void testSyncRequest() throws Exception {
        CountDownLatch requestSent = new CountDownLatch(1);

        // Wait for a request to be sent
        doAnswer(
                        invocation -> {
                            requestSent.countDown();
                            return null;
                        })
                .when(webSocketClient)
                .send(anyString());

        // Send reply asynchronously
        runAsync(
                () -> {
                    try {
                        requestSent.await(2, TimeUnit.SECONDS);
                        sendGethVersionReply();
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                });

        Web3ClientVersion reply = service.send(request, Web3ClientVersion.class);

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