public TopicList getTopicsByCluster(final String cluster, final long timeoutMillis)
        throws RemotingException, MQClientException, InterruptedException {
        GetTopicsByClusterRequestHeader requestHeader = new GetTopicsByClusterRequestHeader();
        requestHeader.setCluster(cluster);
        RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_TOPICS_BY_CLUSTER, requestHeader);
        RemotingCommand response = this.remotingClient.invokeSync(null, request, timeoutMillis);
        assert response != null;
        switch (response.getCode()) {
            case ResponseCode.SUCCESS: {
                byte[] body = response.getBody();
                if (body != null) {
                    TopicList topicList = TopicList.decode(body, TopicList.class);
                    return topicList;
                }
            }
            default:
                break;
        }

        throw new MQClientException(response.getCode(), response.getRemark());
    }
@Test
    public void assertGetTopicsByCluster() throws RemotingException, InterruptedException, MQClientException {
        mockInvokeSync();
        TopicList responseBody = new TopicList();
        responseBody.setBrokerAddr(defaultBrokerAddr);
        responseBody.setTopicList(Collections.singleton(defaultTopic));
        setResponseBody(responseBody);
        TopicList actual = mqClientAPI.getTopicsByCluster(clusterName, defaultTimeout);
        assertNotNull(actual);
        assertEquals(defaultBrokerAddr, actual.getBrokerAddr());
        assertEquals(1, actual.getTopicList().size());
        assertTrue(actual.getTopicList().contains(defaultTopic));
    }