Temporal Workflow Testing [Java]

Using below code for fetching the workflow history -

 public static TestWorkflowRule testWorkflowRule = TestWorkflowRule.newBuilder()

          .setNamespace("telikos-temporal-cdt")
          .setUseExternalService(true)
//          .setTarget("<service:port>") // set if target is not 127.0.0.1:7233 default
          .build();

  public static String getWorkflowExecutionHistory() throws InvalidProtocolBufferException {
    WorkflowClient client = testWorkflowRule.getWorkflowClient();
    WorkflowServiceStubs service = testWorkflowRule.getWorkflowServiceStubs();
    ByteString token = null;
    WorkflowExecution execution = WorkflowExecution.newBuilder().setWorkflowId("UJ07").build();
    GetWorkflowExecutionHistoryRequest request = GetWorkflowExecutionHistoryRequest.newBuilder()
            .setNamespace("telikos-temporal-cdt")
            .setExecution(execution)
            .build();
    GetWorkflowExecutionHistoryResponse result = service.blockingStub().getWorkflowExecutionHistory(request);
    String jsonHistory = JsonFormat.printer().print(result.getHistory());
    return jsonHistory;
  }

Initially the above code is working fine when we were using local cluster using docker container but when we started dedicated cluster, we are seeing below error -

	at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:271)
	at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:252)
	at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:165)
	at io.temporal.api.workflowservice.v1.WorkflowServiceGrpc$WorkflowServiceBlockingStub.getSystemInfo(WorkflowServiceGrpc.java:4139)
	at io.temporal.serviceclient.SystemInfoInterceptor.getServerCapabilitiesOrThrow(SystemInfoInterceptor.java:95)
	at io.temporal.serviceclient.SystemInfoInterceptor$1.start(SystemInfoInterceptor.java:81)
	at io.grpc.stub.ClientCalls.startCall(ClientCalls.java:341)
	at io.grpc.stub.ClientCalls.asyncUnaryRequestCall(ClientCalls.java:315)
	at io.grpc.stub.ClientCalls.futureUnaryCall(ClientCalls.java:227)
	at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:154)
	at io.temporal.api.workflowservice.v1.WorkflowServiceGrpc$WorkflowServiceBlockingStub.getWorkflowExecutionHistory(WorkflowServiceGrpc.java:3724)
	at net.apmoller.crb.telikos.microservices.activityPlanWorkflow.config.TemporalConfig.getWorkflowExecutionHistory(TemporalConfig.java:38)
	at net.apmoller.crb.telikos.microservices.activityPlanWorkflow.steps.StepDef_TemporalTest_1.start_the_workflow_by_sending_data_to_topic(StepDef_TemporalTest_1.java:18)
	at ✽.start the workflow by sending data to topic "ActivityIncomingRequestTopic"(file:///C:/Users/AKK079/Documents/Workspace/InLand/telikos-activityplanworkflow-service/componenttest/src/test/resources/features/TemporalTest_1.feature:5)
Caused by: io.grpc.netty.shaded.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: /127.0.0.1:7233
Caused by: java.net.ConnectException: Connection refused: no further information

NOTE : we are suspecting this is due to missing attribute for " .setTarget(“service:port”)" but we have not configured/used any port for SDK .

Unless the dedicated cluster listens on 127.0.0.1:7233 you have to specify the target.