### Question:
WebSocketService implements Web3jService { @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()); } } WebSocketService(String serverUrl, boolean includeRawResponses);  WebSocketService(WebSocketClient webSocketClient,
                     boolean includeRawResponses);   WebSocketService(WebSocketClient webSocketClient,
                     ScheduledExecutorService executor,
                     boolean includeRawResponses); void connect(); @Override T send(Request request, Class<T> responseType); @Override CompletableFuture<T> sendAsync(
            Request request,
            Class<T> responseType); @Override Observable<T> subscribe(
            Request request,
            String unsubscribeMethod,
            Class<T> responseType); @Override void close();  }### Answer:
@Test public void testSyncRequest() throws Exception { CountDownLatch requestSent = new CountDownLatch(1); doAnswer(invocation -> { requestSent.countDown(); return null; }).when(webSocketClient).send(anyString()); 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"); }