@@ -82,9 +82,6 @@ public static Builder newBuilder() {
82
82
return new AutoValue_EndpointContext .Builder ().setSwitchToMtlsEndpointAllowed (false );
83
83
}
84
84
85
- // By default, the clientSettingsEndpoint value is the default_host endpoint
86
- // value configured in the service. Users can override this value by the Setter
87
- // exposed in the Client/Stub Settings or in the TransportChannelProvider.
88
85
@ VisibleForTesting
89
86
void determineEndpoint () throws IOException {
90
87
if (resolvedEndpoint != null && resolvedUniverseDomain != null ) {
@@ -93,7 +90,7 @@ void determineEndpoint() throws IOException {
93
90
MtlsProvider mtlsProvider = mtlsProvider () == null ? new MtlsProvider () : mtlsProvider ();
94
91
String customEndpoint =
95
92
transportChannelEndpoint () != null ? transportChannelEndpoint () : clientSettingsEndpoint ();
96
- // This means that there are no user configured endpoints, use the default endpoint
93
+ // If there are no user configured endpoints, use the default endpoints
97
94
if (customEndpoint == null ) {
98
95
if (switchToMtlsEndpointAllowed () && mtlsProvider != null ) {
99
96
resolvedEndpoint =
@@ -105,7 +102,8 @@ void determineEndpoint() throws IOException {
105
102
return ;
106
103
}
107
104
Matcher matcher = ENDPOINT_REGEX .matcher (customEndpoint );
108
- // Check if it matches the ENDPOINT_TEMPLATE format
105
+ // Check if it matches the ENDPOINT_TEMPLATE format, otherwise use the
106
+ // custom set endpoint
109
107
if (!matcher .matches ()) {
110
108
resolvedEndpoint = customEndpoint ;
111
109
resolvedUniverseDomain = GOOGLE_DEFAULT_UNIVERSE ;
@@ -126,11 +124,12 @@ void determineEndpoint() throws IOException {
126
124
customEndpoint = customEndpoint .substring (8 );
127
125
}
128
126
127
+ // Parse the custom endpoint for the service name, universe domain, and the port
129
128
int periodIndex = customEndpoint .indexOf ('.' );
130
129
int colonIndex = customEndpoint .indexOf (':' );
131
130
String serviceName = customEndpoint .substring (0 , periodIndex );
132
131
String universeDomain ;
133
- String port = "443" ;
132
+ String port = DEFAULT_PORT ;
134
133
if (colonIndex != -1 ) {
135
134
universeDomain = customEndpoint .substring (periodIndex + 1 , colonIndex );
136
135
port = customEndpoint .substring (colonIndex + 1 );
0 commit comments