diff --git a/google-cloud-pubsub/.factorypath b/google-cloud-pubsub/.factorypath
new file mode 100644
index 000000000..27b6d1c5a
--- /dev/null
+++ b/google-cloud-pubsub/.factorypath
@@ -0,0 +1,3 @@
+
+
+
diff --git a/google-cloud-pubsub/pom.xml b/google-cloud-pubsub/pom.xml
index 74d79fde2..e65cade24 100644
--- a/google-cloud-pubsub/pom.xml
+++ b/google-cloud-pubsub/pom.xml
@@ -17,17 +17,35 @@
google-cloud-pubsub
+
+ io.grpc
+ grpc-netty-shaded
+ 1.37.0-SNAPSHOT
+
io.grpc
grpc-api
+ 1.37.0-SNAPSHOT
+
+
+ io.grpc
+ grpc-auth
+ 1.37.0-SNAPSHOT
+
+
+ io.grpc
+ grpc-grpclb
+ 1.37.0-SNAPSHOT
io.grpc
grpc-stub
+ 1.37.0-SNAPSHOT
io.grpc
grpc-protobuf
+ 1.37.0-SNAPSHOT
com.google.api
@@ -77,6 +95,7 @@
io.grpc
grpc-core
+ 1.37.0-SNAPSHOT
com.google.errorprone
@@ -192,4 +211,4 @@
-
\ No newline at end of file
+
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java
index 696671660..b4e144fc3 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java
@@ -233,6 +233,10 @@ public static String getDefaultEndpoint() {
return "pubsub.googleapis.com:443";
}
+ public static String getDefaultMtlsEndpoint() {
+ return "pubsub.mtls.googleapis.com:443";
+ }
+
/** Returns the default service scopes. */
public static List getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
@@ -695,6 +699,8 @@ private static Builder createDefault() {
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
return initDefaults(builder);
}
diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/aMtlsSampleTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/aMtlsSampleTest.java
new file mode 100644
index 000000000..7fe5f0db6
--- /dev/null
+++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/aMtlsSampleTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2016 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.pubsub.v1;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.google.pubsub.v1.ProjectName;
+import com.google.pubsub.v1.Topic;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class aMtlsSampleTest {
+ @Test
+ public void myTest() throws Exception {
+ Logger log = Logger.getLogger("io.grpc");
+ log.setLevel(Level.FINEST);
+ TopicAdminClient topicAdminClient = TopicAdminClient.create();
+ ProjectName projectName = ProjectName.of("dcatest-281318");
+ for (Topic topic : topicAdminClient.listTopics(projectName).iterateAll()) {
+ System.out.println(topic.getName());
+ }
+ System.out.println("Listed all topics.");
+ }
+}
+