Add proto_server_reflection_test
diff --git a/Makefile b/Makefile
index 673fbf2..97377db 100644
--- a/Makefile
+++ b/Makefile
@@ -1034,6 +1034,7 @@
 json_run_localhost: $(BINDIR)/$(CONFIG)/json_run_localhost
 metrics_client: $(BINDIR)/$(CONFIG)/metrics_client
 mock_test: $(BINDIR)/$(CONFIG)/mock_test
+proto_server_reflection_test: $(BINDIR)/$(CONFIG)/proto_server_reflection_test
 qps_interarrival_test: $(BINDIR)/$(CONFIG)/qps_interarrival_test
 qps_json_driver: $(BINDIR)/$(CONFIG)/qps_json_driver
 qps_openloop_test: $(BINDIR)/$(CONFIG)/qps_openloop_test
@@ -1041,7 +1042,6 @@
 qps_worker: $(BINDIR)/$(CONFIG)/qps_worker
 reconnect_interop_client: $(BINDIR)/$(CONFIG)/reconnect_interop_client
 reconnect_interop_server: $(BINDIR)/$(CONFIG)/reconnect_interop_server
-reflection_debug_test: $(BINDIR)/$(CONFIG)/reflection_debug_test
 secure_auth_context_test: $(BINDIR)/$(CONFIG)/secure_auth_context_test
 secure_sync_unary_ping_pong_test: $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test
 server_builder_plugin_test: $(BINDIR)/$(CONFIG)/server_builder_plugin_test
@@ -1404,6 +1404,7 @@
   $(BINDIR)/$(CONFIG)/json_run_localhost \
   $(BINDIR)/$(CONFIG)/metrics_client \
   $(BINDIR)/$(CONFIG)/mock_test \
+  $(BINDIR)/$(CONFIG)/proto_server_reflection_test \
   $(BINDIR)/$(CONFIG)/qps_interarrival_test \
   $(BINDIR)/$(CONFIG)/qps_json_driver \
   $(BINDIR)/$(CONFIG)/qps_openloop_test \
@@ -1411,7 +1412,6 @@
   $(BINDIR)/$(CONFIG)/qps_worker \
   $(BINDIR)/$(CONFIG)/reconnect_interop_client \
   $(BINDIR)/$(CONFIG)/reconnect_interop_server \
-  $(BINDIR)/$(CONFIG)/reflection_debug_test \
   $(BINDIR)/$(CONFIG)/secure_auth_context_test \
   $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \
   $(BINDIR)/$(CONFIG)/server_builder_plugin_test \
@@ -1740,12 +1740,12 @@
 	$(Q) $(BINDIR)/$(CONFIG)/interop_test || ( echo test interop_test failed ; exit 1 )
 	$(E) "[RUN]     Testing mock_test"
 	$(Q) $(BINDIR)/$(CONFIG)/mock_test || ( echo test mock_test failed ; exit 1 )
+	$(E) "[RUN]     Testing proto_server_reflection_test"
+	$(Q) $(BINDIR)/$(CONFIG)/proto_server_reflection_test || ( echo test proto_server_reflection_test failed ; exit 1 )
 	$(E) "[RUN]     Testing qps_openloop_test"
 	$(Q) $(BINDIR)/$(CONFIG)/qps_openloop_test || ( echo test qps_openloop_test failed ; exit 1 )
 	$(E) "[RUN]     Testing qps_test"
 	$(Q) $(BINDIR)/$(CONFIG)/qps_test || ( echo test qps_test failed ; exit 1 )
-	$(E) "[RUN]     Testing reflection_debug_test"
-	$(Q) $(BINDIR)/$(CONFIG)/reflection_debug_test || ( echo test reflection_debug_test failed ; exit 1 )
 	$(E) "[RUN]     Testing secure_auth_context_test"
 	$(Q) $(BINDIR)/$(CONFIG)/secure_auth_context_test || ( echo test secure_auth_context_test failed ; exit 1 )
 	$(E) "[RUN]     Testing secure_sync_unary_ping_pong_test"
@@ -11193,6 +11193,52 @@
 endif
 
 
+PROTO_SERVER_REFLECTION_TEST_SRC = \
+    test/cpp/end2end/proto_server_reflection_test.cc \
+    test/cpp/util/proto_reflection_descriptor_database.cc \
+
+PROTO_SERVER_REFLECTION_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(PROTO_SERVER_REFLECTION_TEST_SRC))))
+ifeq ($(NO_SECURE),true)
+
+# You can't build secure targets if you don't have OpenSSL.
+
+$(BINDIR)/$(CONFIG)/proto_server_reflection_test: openssl_dep_error
+
+else
+
+
+
+
+ifeq ($(NO_PROTOBUF),true)
+
+# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
+
+$(BINDIR)/$(CONFIG)/proto_server_reflection_test: protobuf_dep_error
+
+else
+
+$(BINDIR)/$(CONFIG)/proto_server_reflection_test: $(PROTOBUF_DEP) $(PROTO_SERVER_REFLECTION_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+	$(E) "[LD]      Linking $@"
+	$(Q) mkdir -p `dirname $@`
+	$(Q) $(LDXX) $(LDFLAGS) $(PROTO_SERVER_REFLECTION_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/proto_server_reflection_test
+
+endif
+
+endif
+
+$(OBJDIR)/$(CONFIG)/test/cpp/end2end/proto_server_reflection_test.o:  $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+
+$(OBJDIR)/$(CONFIG)/test/cpp/util/proto_reflection_descriptor_database.o:  $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+
+deps_proto_server_reflection_test: $(PROTO_SERVER_REFLECTION_TEST_OBJS:.o=.dep)
+
+ifneq ($(NO_SECURE),true)
+ifneq ($(NO_DEPS),true)
+-include $(PROTO_SERVER_REFLECTION_TEST_OBJS:.o=.dep)
+endif
+endif
+
+
 QPS_INTERARRIVAL_TEST_SRC = \
     test/cpp/qps/qps_interarrival_test.cc \
 
@@ -11517,52 +11563,6 @@
 $(OBJDIR)/$(CONFIG)/test/cpp/interop/reconnect_interop_server.o: $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc
 
 
-REFLECTION_DEBUG_TEST_SRC = \
-    test/cpp/util/proto_reflection_descriptor_database.cc \
-    test/cpp/util/reflection_debug/reflection_client.cc \
-
-REFLECTION_DEBUG_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(REFLECTION_DEBUG_TEST_SRC))))
-ifeq ($(NO_SECURE),true)
-
-# You can't build secure targets if you don't have OpenSSL.
-
-$(BINDIR)/$(CONFIG)/reflection_debug_test: openssl_dep_error
-
-else
-
-
-
-
-ifeq ($(NO_PROTOBUF),true)
-
-# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
-
-$(BINDIR)/$(CONFIG)/reflection_debug_test: protobuf_dep_error
-
-else
-
-$(BINDIR)/$(CONFIG)/reflection_debug_test: $(PROTOBUF_DEP) $(REFLECTION_DEBUG_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
-	$(E) "[LD]      Linking $@"
-	$(Q) mkdir -p `dirname $@`
-	$(Q) $(LDXX) $(LDFLAGS) $(REFLECTION_DEBUG_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/reflection_debug_test
-
-endif
-
-endif
-
-$(OBJDIR)/$(CONFIG)/test/cpp/util/proto_reflection_descriptor_database.o:  $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
-
-$(OBJDIR)/$(CONFIG)/test/cpp/util/reflection_debug/reflection_client.o:  $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
-
-deps_reflection_debug_test: $(REFLECTION_DEBUG_TEST_OBJS:.o=.dep)
-
-ifneq ($(NO_SECURE),true)
-ifneq ($(NO_DEPS),true)
--include $(REFLECTION_DEBUG_TEST_OBJS:.o=.dep)
-endif
-endif
-
-
 SECURE_AUTH_CONTEXT_TEST_SRC = \
     test/cpp/common/secure_auth_context_test.cc \
 
diff --git a/build.yaml b/build.yaml
index c165304..5465c3b 100644
--- a/build.yaml
+++ b/build.yaml
@@ -2787,6 +2787,23 @@
   - grpc
   - gpr_test_util
   - gpr
+- name: proto_server_reflection_test
+  gtest: true
+  build: test
+  language: c++
+  headers:
+  - test/cpp/util/proto_reflection_descriptor_database.h
+  src:
+  - test/cpp/end2end/proto_server_reflection_test.cc
+  - test/cpp/util/proto_reflection_descriptor_database.cc
+  deps:
+  - grpc++_reflection
+  - grpc++_test_util
+  - grpc_test_util
+  - grpc++
+  - grpc
+  - gpr_test_util
+  - gpr
 - name: qps_interarrival_test
   build: test
   run: false
@@ -2915,19 +2932,6 @@
   - gpr_test_util
   - gpr
   - grpc++_test_config
-- name: reflection_debug_test
-  build: test
-  language: c++
-  headers:
-  - test/cpp/util/proto_reflection_descriptor_database.h
-  src:
-  - test/cpp/util/proto_reflection_descriptor_database.cc
-  - test/cpp/util/reflection_debug/reflection_client.cc
-  deps:
-  - grpc++_reflection
-  - grpc++
-  - grpc
-  - gpr
 - name: secure_auth_context_test
   gtest: true
   build: test
diff --git a/extensions/include/grpc++/impl/proto_server_reflection_plugin.h b/extensions/include/grpc++/impl/proto_server_reflection_plugin.h
index e09c413..df0abb2 100644
--- a/extensions/include/grpc++/impl/proto_server_reflection_plugin.h
+++ b/extensions/include/grpc++/impl/proto_server_reflection_plugin.h
@@ -61,17 +61,12 @@
   std::shared_ptr<::grpc::ProtoServerReflection> reflection_service;
 };
 
-// std::unique_ptr<::grpc::ServerBuilderPlugin> CreateProtoReflection() {
-//   return std::unique_ptr<::grpc::ServerBuilderPlugin>(
-//       new ProtoServerReflectionPlugin());
-// }
-
 std::unique_ptr<::grpc::ServerBuilderPlugin> CreateProtoReflection();
 
 void grpc_AddServerBuilderPlugin_reflection();
 
 // Force AddServerBuilderPlugin() to be called at static initialization time.
-struct StaticPluginInitializer_reflection {
+static struct StaticPluginInitializer_reflection {
   StaticPluginInitializer_reflection() {
     grpc_AddServerBuilderPlugin_reflection();
   }
diff --git a/test/cpp/end2end/proto_server_reflection_test.cc b/test/cpp/end2end/proto_server_reflection_test.cc
new file mode 100644
index 0000000..ae77065
--- /dev/null
+++ b/test/cpp/end2end/proto_server_reflection_test.cc
@@ -0,0 +1,165 @@
+/*
+ *
+ * Copyright 2016, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <google/protobuf/descriptor.h>
+#include <grpc++/channel.h>
+#include <grpc++/client_context.h>
+#include <grpc++/create_channel.h>
+#include <grpc++/impl/proto_server_reflection_plugin.h>
+#include <grpc++/security/credentials.h>
+#include <grpc++/security/server_credentials.h>
+#include <grpc++/server.h>
+#include <grpc++/server_builder.h>
+#include <grpc++/server_context.h>
+#include <grpc/grpc.h>
+#include <gtest/gtest.h>
+
+#include "src/proto/grpc/testing/echo.grpc.pb.h"
+#include "test/core/util/port.h"
+#include "test/core/util/test_config.h"
+#include "test/cpp/end2end/test_service_impl.h"
+#include "test/cpp/util/proto_reflection_descriptor_database.h"
+
+namespace grpc {
+namespace testing {
+
+class ProtoServerReflectionTest : public ::testing::Test {
+ public:
+  ProtoServerReflectionTest() {}
+
+  void SetUp() GRPC_OVERRIDE {
+    port_ = grpc_pick_unused_port_or_die();
+    ref_desc_pool_ = google::protobuf::DescriptorPool::generated_pool();
+
+    ServerBuilder builder;
+    grpc::string server_address = "localhost:" + to_string(port_);
+    builder.AddListeningPort(server_address, InsecureServerCredentials());
+    server_ = builder.BuildAndStart();
+  }
+
+  void ResetStub() {
+    string target = "dns:localhost:" + to_string(port_);
+    std::shared_ptr<Channel> channel =
+        CreateChannel(target, InsecureChannelCredentials());
+    stub_ = grpc::testing::EchoTestService::NewStub(channel);
+    desc_db_.reset(new ProtoReflectionDescriptorDatabase(channel));
+    desc_pool_.reset(new google::protobuf::DescriptorPool(desc_db_.get()));
+  }
+
+  string to_string(const int number) {
+    std::stringstream strs;
+    strs << number;
+    return strs.str();
+  }
+
+  void CompareService(const grpc::string& service) {
+    const google::protobuf::ServiceDescriptor* service_desc =
+        desc_pool_->FindServiceByName(service);
+    const google::protobuf::ServiceDescriptor* ref_service_desc =
+        ref_desc_pool_->FindServiceByName(service);
+    EXPECT_TRUE(service_desc != nullptr);
+    EXPECT_TRUE(ref_service_desc != nullptr);
+    EXPECT_EQ(service_desc->DebugString(), ref_service_desc->DebugString());
+
+    const google::protobuf::FileDescriptor* file_desc = service_desc->file();
+    if (known_files_.find(file_desc->package() + "/" + file_desc->name()) !=
+        known_files_.end()) {
+      EXPECT_EQ(file_desc->DebugString(),
+                ref_service_desc->file()->DebugString());
+      known_files_.insert(file_desc->package() + "/" + file_desc->name());
+    }
+
+    for (int i = 0; i < service_desc->method_count(); ++i) {
+      CompareMethod(service_desc->method(i)->full_name());
+    }
+  }
+
+  void CompareMethod(const grpc::string& method) {
+    const google::protobuf::MethodDescriptor* method_desc =
+        desc_pool_->FindMethodByName(method);
+    const google::protobuf::MethodDescriptor* ref_method_desc =
+        ref_desc_pool_->FindMethodByName(method);
+    EXPECT_TRUE(method_desc != nullptr);
+    EXPECT_TRUE(ref_method_desc != nullptr);
+    EXPECT_EQ(method_desc->DebugString(), ref_method_desc->DebugString());
+
+    CompareType(method_desc->input_type()->full_name());
+    CompareType(method_desc->output_type()->full_name());
+  }
+
+  void CompareType(const grpc::string& type) {
+    if (known_types_.find(type) != known_types_.end()) {
+      return;
+    }
+
+    const google::protobuf::Descriptor* desc =
+        desc_pool_->FindMessageTypeByName(type);
+    const google::protobuf::Descriptor* ref_desc =
+        ref_desc_pool_->FindMessageTypeByName(type);
+    EXPECT_TRUE(desc != nullptr);
+    EXPECT_TRUE(ref_desc != nullptr);
+    EXPECT_EQ(desc->DebugString(), ref_desc->DebugString());
+  }
+
+ protected:
+  std::unique_ptr<Server> server_;
+  std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
+  std::unique_ptr<ProtoReflectionDescriptorDatabase> desc_db_;
+  std::unique_ptr<google::protobuf::DescriptorPool> desc_pool_;
+  std::unordered_set<string> known_files_;
+  std::unordered_set<string> known_types_;
+  const google::protobuf::DescriptorPool* ref_desc_pool_;
+  int port_;
+};
+
+TEST_F(ProtoServerReflectionTest, CheckResponseWithLocalDescriptorPool) {
+  ResetStub();
+
+  std::vector<std::string> services;
+  desc_db_->GetServices(&services);
+  // The service list has at least one service (reflection servcie).
+  EXPECT_TRUE(services.size() > 0);
+
+  for (auto it = services.begin(); it != services.end(); ++it) {
+    CompareService(*it);
+  }
+}
+
+}  // namespace testing
+}  // namespace grpc
+
+int main(int argc, char** argv) {
+  grpc_test_init(argc, argv);
+  ::testing::InitGoogleTest(&argc, argv);
+  return RUN_ALL_TESTS();
+}
diff --git a/test/cpp/util/reflection_debug/Makefile b/test/cpp/util/reflection_debug/Makefile
deleted file mode 100644
index 9eea5ae..0000000
--- a/test/cpp/util/reflection_debug/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-
-# Copyright 2015-2016, Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-#     * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-#     * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-CXX = g++
-INCLUDES += -I. -I..
-CPPFLAGS += -I/usr/local/include -pthread
-CXXFLAGS += -std=c++11 ${INCLUDES}
-LDFLAGS += -L/usr/local/lib -lgrpc++_unsecure -lgrpc -lgrpc++_reflection -lprotobuf -lpthread -ldl
-VPATH = ..
-
-# PROTOS_PATH = ../../../src/cpp/plugin/reflection
-
-vpath %.proto $(PROTOS_PATH)
-
-all: reflection_client
-
-reflection_client: proto_reflection_descriptor_database.o reflection_client.o
-	$(CXX) $(INCLUDES) $^ $(LDFLAGS) -o $@
-
-
-clean:
-	rm -f *.o reflection_client
diff --git a/test/cpp/util/reflection_debug/reflection_client.cc b/test/cpp/util/reflection_debug/reflection_client.cc
deleted file mode 100644
index a1e97f7..0000000
--- a/test/cpp/util/reflection_debug/reflection_client.cc
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- *
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <iomanip>
-#include <iostream>
-#include <memory>
-#include <string>
-
-#include <google/protobuf/descriptor.h>
-#include <google/protobuf/descriptor.pb.h>
-#include <grpc++/grpc++.h>
-
-#include "proto_reflection_descriptor_database.h"
-// #include "reflection.grpc.pb.h"
-
-using grpc::Channel;
-using grpc::ClientContext;
-using grpc::Status;
-using grpc::ProtoReflectionDescriptorDatabase;
-using grpc::reflection::v1alpha::ServerReflection;
-// using grpc::reflection::v1alpha::EmptyRequest;
-// using grpc::reflection::v1alpha::ListServiceResponse;
-using google::protobuf::FileDescriptorProto;
-using google::protobuf::DescriptorPool;
-using google::protobuf::ServiceDescriptor;
-using google::protobuf::MethodDescriptor;
-using google::protobuf::Descriptor;
-using google::protobuf::FieldDescriptor;
-
-class ReflectionClient {
- public:
-  ReflectionClient(std::shared_ptr<Channel> channel)
-      : db_(new ProtoReflectionDescriptorDatabase(
-            ServerReflection::NewStub(channel))),
-        desc_pool_(new DescriptorPool(db_.get())) {}
-
-  void PrintInfo() {
-    std::vector<std::string> services;
-    bool found_services = db_->GetServices(&services);
-    if (found_services) {
-      std::string padding = "";
-      std::cout << "Service amount:" << services.size() << std::endl;
-      for (auto it = services.begin(); it != services.end(); ++it) {
-        if (it != services.end() - 1) {
-          std::cout << padding << "│ " << std::endl;
-          std::cout << padding << "├─" << *it << std::endl;
-          PrintService(desc_pool_->FindServiceByName(*it), padding + "│ ");
-        } else {
-          std::cout << padding << "│ " << std::endl;
-          std::cout << padding << "└─" << *it << std::endl;
-          PrintService(desc_pool_->FindServiceByName(*it), padding + "  ");
-        }
-      }
-    }
-  }
-
-  void PrintService(const ServiceDescriptor* service_desc,
-                    const std::string padding) {
-    if (service_desc != nullptr) {
-      std::cout << padding << "│ Method amount:" << service_desc->method_count()
-                << std::endl;
-      for (int i = 0; i < service_desc->method_count(); ++i) {
-        if (i != service_desc->method_count() - 1) {
-          std::cout << padding << "├─" << service_desc->method(i)->name()
-                    << std::endl;
-          PrintMethod(service_desc->method(i), padding + "│ ");
-        } else {
-          std::cout << padding << "└─" << service_desc->method(i)->name()
-                    << std::endl;
-          PrintMethod(service_desc->method(i), padding + "  ");
-        }
-      }
-    }
-  }
-
-  void PrintMethod(const MethodDescriptor* method_desc,
-                   const std::string padding) {
-    if (method_desc != nullptr) {
-      std::cout << padding
-                << "├─input type: " << method_desc->input_type()->name()
-                << std::endl;
-      PrintMessageType(method_desc->input_type(), padding + "│ ");
-      std::cout << padding
-                << "└─output type: " << method_desc->output_type()->name()
-                << std::endl;
-      PrintMessageType(method_desc->output_type(), padding + "  ");
-    }
-  }
-
-  void PrintMessageType(const Descriptor* type_desc,
-                        const std::string padding) {
-    if (type_desc != nullptr) {
-      if (type_desc->field_count() > 0) {
-        std::cout << padding << "│ Field amount:" << type_desc->field_count()
-                  << std::endl;
-      }
-      for (int i = 0; i < type_desc->field_count(); ++i) {
-        if (i != type_desc->field_count() - 1) {
-          const FieldDescriptor* field = type_desc->field(i);
-          std::cout << padding << "├─ " << std::left << std::setw(15)
-                    << kLabelToName[field->label()] << std::setw(30)
-                    << " name: " + field->name() << std::setw(50)
-                    << " type: " +
-                           (field->type() == FieldDescriptor::Type::TYPE_MESSAGE
-                                ? field->message_type()->name()
-                                : field->type_name())
-                    << std::endl;
-        } else {
-          const FieldDescriptor* field = type_desc->field(i);
-          std::cout << padding << "└─ " << std::left << std::setw(15)
-                    << kLabelToName[field->label()] << std::setw(30)
-                    << " name: " + field->name() << std::setw(50)
-                    << " type: " +
-                           (field->type() == FieldDescriptor::Type::TYPE_MESSAGE
-                                ? field->message_type()->name()
-                                : field->type_name())
-                    << std::endl;
-        }
-      }
-    }
-  }
-
-  void Test() {
-    {
-      std::vector<std::string> services;
-      bool found = db_->GetServices(&services);
-      if (found) {
-        for (auto it : services) {
-          std::cout << it << std::endl;
-        }
-      }
-    }
-    {
-      FileDescriptorProto output;
-      bool found = db_->FindFileByName("helloworld.proto", &output);
-      if (found) std::cout << output.name() << std::endl;
-    }
-    {
-      FileDescriptorProto output;
-      bool found =
-          db_->FindFileContainingSymbol("helloworld.Greeter.SayHello", &output);
-      if (found) std::cout << output.name() << std::endl;
-    }
-    {
-      FileDescriptorProto output;
-      bool found = db_->FindFileContainingExtension(
-          "helloworld.Greeter.HelloRequest", 1, &output);
-      found = db_->FindFileContainingExtension(
-          "helloworld.Greeter.HelloRequest", 1, &output);
-      if (found) std::cout << output.name() << std::endl;
-    }
-    // DescriptorPool pool(db_.get());
-    // std::cout << pool.FindServiceByName("helloworld.Greeter")->name()
-    //           << std::endl;
-  }
-
- private:
-  const char* const kLabelToName[FieldDescriptor::Label::MAX_LABEL + 1] = {
-      "ERROR",  // 0 is reserved for errors
-
-      "optional",  // LABEL_OPTIONAL
-      "required",  // LABEL_REQUIRED
-      "repeated",  // LABEL_REPEATED
-  };
-
-  std::unique_ptr<ProtoReflectionDescriptorDatabase> db_;
-  std::unique_ptr<DescriptorPool> desc_pool_;
-};
-
-int main(int argc, char** argv) {
-  int port = 50051;
-  if (argc == 2) {
-    try {
-      port = std::stoi(argv[1]);
-      if (port > 65535 || port < 1024) {
-        throw std::out_of_range("Port number out of range.");
-      }
-    } catch (std::invalid_argument&) {
-    } catch (std::out_of_range&) {
-    }
-  }
-
-  ReflectionClient reflection_client(grpc::CreateChannel(
-      "localhost:" + std::to_string(port), grpc::InsecureChannelCredentials()));
-
-  reflection_client.PrintInfo();
-
-  return 0;
-}
diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json
index 3eae785..f1d344b 100644
--- a/tools/run_tests/sources_and_headers.json
+++ b/tools/run_tests/sources_and_headers.json
@@ -2395,6 +2395,29 @@
       "gpr_test_util", 
       "grpc", 
       "grpc++", 
+      "grpc++_reflection", 
+      "grpc++_test_util", 
+      "grpc_test_util"
+    ], 
+    "headers": [
+      "test/cpp/util/proto_reflection_descriptor_database.h"
+    ], 
+    "language": "c++", 
+    "name": "proto_server_reflection_test", 
+    "src": [
+      "test/cpp/end2end/proto_server_reflection_test.cc", 
+      "test/cpp/util/proto_reflection_descriptor_database.cc", 
+      "test/cpp/util/proto_reflection_descriptor_database.h"
+    ], 
+    "third_party": false, 
+    "type": "target"
+  }, 
+  {
+    "deps": [
+      "gpr", 
+      "gpr_test_util", 
+      "grpc", 
+      "grpc++", 
       "grpc++_test_util", 
       "grpc_test_util", 
       "qps"
@@ -2554,26 +2577,6 @@
   {
     "deps": [
       "gpr", 
-      "grpc", 
-      "grpc++", 
-      "grpc++_reflection"
-    ], 
-    "headers": [
-      "test/cpp/util/proto_reflection_descriptor_database.h"
-    ], 
-    "language": "c++", 
-    "name": "reflection_debug_test", 
-    "src": [
-      "test/cpp/util/proto_reflection_descriptor_database.cc", 
-      "test/cpp/util/proto_reflection_descriptor_database.h", 
-      "test/cpp/util/reflection_debug/reflection_client.cc"
-    ], 
-    "third_party": false, 
-    "type": "target"
-  }, 
-  {
-    "deps": [
-      "gpr", 
       "gpr_test_util", 
       "grpc", 
       "grpc++", 
diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json
index 0025b48..47098fb 100644
--- a/tools/run_tests/tests.json
+++ b/tools/run_tests/tests.json
@@ -2375,6 +2375,27 @@
     "ci_platforms": [
       "linux", 
       "mac", 
+      "posix", 
+      "windows"
+    ], 
+    "cpu_cost": 1.0, 
+    "exclude_configs": [], 
+    "flaky": false, 
+    "gtest": true, 
+    "language": "c++", 
+    "name": "proto_server_reflection_test", 
+    "platforms": [
+      "linux", 
+      "mac", 
+      "posix", 
+      "windows"
+    ]
+  }, 
+  {
+    "args": [], 
+    "ci_platforms": [
+      "linux", 
+      "mac", 
       "posix"
     ], 
     "cpu_cost": 0.5, 
@@ -2419,27 +2440,6 @@
     "cpu_cost": 1.0, 
     "exclude_configs": [], 
     "flaky": false, 
-    "gtest": false, 
-    "language": "c++", 
-    "name": "reflection_debug_test", 
-    "platforms": [
-      "linux", 
-      "mac", 
-      "posix", 
-      "windows"
-    ]
-  }, 
-  {
-    "args": [], 
-    "ci_platforms": [
-      "linux", 
-      "mac", 
-      "posix", 
-      "windows"
-    ], 
-    "cpu_cost": 1.0, 
-    "exclude_configs": [], 
-    "flaky": false, 
     "gtest": true, 
     "language": "c++", 
     "name": "secure_auth_context_test", 
diff --git a/vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj b/vsprojects/vcxproj/test/proto_server_reflection_test/proto_server_reflection_test.vcxproj
similarity index 93%
rename from vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj
rename to vsprojects/vcxproj/test/proto_server_reflection_test/proto_server_reflection_test.vcxproj
index 757e1cd..27fc168 100644
--- a/vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj
+++ b/vsprojects/vcxproj/test/proto_server_reflection_test/proto_server_reflection_test.vcxproj
@@ -20,7 +20,7 @@
     </ProjectConfiguration>
   </ItemGroup>
   <PropertyGroup Label="Globals">
-    <ProjectGuid>{037B9EA1-03CC-6A3B-4E4B-DB17C3D59CF8}</ProjectGuid>
+    <ProjectGuid>{1881E6A1-EAD4-A68C-9727-FF1956B66185}</ProjectGuid>
     <IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected>
     <IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir>
   </PropertyGroup>
@@ -62,14 +62,14 @@
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)'=='Debug'">
-    <TargetName>reflection_debug_test</TargetName>
+    <TargetName>proto_server_reflection_test</TargetName>
     <Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
     <Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib>
     <Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl>
     <Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)'=='Release'">
-    <TargetName>reflection_debug_test</TargetName>
+    <TargetName>proto_server_reflection_test</TargetName>
     <Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
     <Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib>
     <Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl>
@@ -163,21 +163,30 @@
     <ClInclude Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.h" />
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.cc">
+    <ClCompile Include="$(SolutionDir)\..\test\cpp\end2end\proto_server_reflection_test.cc">
     </ClCompile>
-    <ClCompile Include="$(SolutionDir)\..\test\cpp\util\reflection_debug\reflection_client.cc">
+    <ClCompile Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.cc">
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++_reflection\grpc++_reflection.vcxproj">
       <Project>{5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}</Project>
     </ProjectReference>
+    <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++_test_util\grpc++_test_util.vcxproj">
+      <Project>{0BE77741-552A-929B-A497-4EF7ECE17A64}</Project>
+    </ProjectReference>
+    <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_test_util\grpc_test_util.vcxproj">
+      <Project>{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}</Project>
+    </ProjectReference>
     <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++\grpc++.vcxproj">
       <Project>{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}</Project>
     </ProjectReference>
     <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj">
       <Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project>
     </ProjectReference>
+    <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr_test_util\gpr_test_util.vcxproj">
+      <Project>{EAB0A629-17A9-44DB-B5FF-E91A721FE037}</Project>
+    </ProjectReference>
     <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr\gpr.vcxproj">
       <Project>{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}</Project>
     </ProjectReference>
diff --git a/vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj.filters b/vsprojects/vcxproj/test/proto_server_reflection_test/proto_server_reflection_test.vcxproj.filters
similarity index 62%
rename from vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj.filters
rename to vsprojects/vcxproj/test/proto_server_reflection_test/proto_server_reflection_test.vcxproj.filters
index 6258ace..6d6e5c1 100644
--- a/vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj.filters
+++ b/vsprojects/vcxproj/test/proto_server_reflection_test/proto_server_reflection_test.vcxproj.filters
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup>
+    <ClCompile Include="$(SolutionDir)\..\test\cpp\end2end\proto_server_reflection_test.cc">
+      <Filter>test\cpp\end2end</Filter>
+    </ClCompile>
     <ClCompile Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.cc">
       <Filter>test\cpp\util</Filter>
     </ClCompile>
-    <ClCompile Include="$(SolutionDir)\..\test\cpp\util\reflection_debug\reflection_client.cc">
-      <Filter>test\cpp\util\reflection_debug</Filter>
-    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.h">
@@ -16,16 +16,16 @@
 
   <ItemGroup>
     <Filter Include="test">
-      <UniqueIdentifier>{fdf7e642-420d-9e18-7a3c-19dca964f218}</UniqueIdentifier>
+      <UniqueIdentifier>{354831a1-52fb-6364-b568-c8c49bfb8d29}</UniqueIdentifier>
     </Filter>
     <Filter Include="test\cpp">
-      <UniqueIdentifier>{562b3927-e256-190d-ab72-6b4b04ffb8b2}</UniqueIdentifier>
+      <UniqueIdentifier>{b4d957ef-f9fd-2a14-078c-b72f80096f70}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="test\cpp\end2end">
+      <UniqueIdentifier>{130f224c-89a5-54ea-7045-b54b4188c52b}</UniqueIdentifier>
     </Filter>
     <Filter Include="test\cpp\util">
-      <UniqueIdentifier>{8ed08be4-a27c-d51c-d587-a02cf3dc5abc}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="test\cpp\util\reflection_debug">
-      <UniqueIdentifier>{b84b1385-e0b2-239b-bac2-81a16bc90249}</UniqueIdentifier>
+      <UniqueIdentifier>{aae81aad-5563-fceb-1461-10fdec84c5b0}</UniqueIdentifier>
     </Filter>
   </ItemGroup>
 </Project>