aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio_test/grpc_interop/server.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/python/grpcio_test/grpc_interop/server.py')
-rw-r--r--src/python/grpcio_test/grpc_interop/server.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/python/grpcio_test/grpc_interop/server.py b/src/python/grpcio_test/grpc_interop/server.py
index 60f630a6be..b541087663 100644
--- a/src/python/grpcio_test/grpc_interop/server.py
+++ b/src/python/grpcio_test/grpc_interop/server.py
@@ -33,10 +33,11 @@ import argparse
import logging
import time
-from grpc.early_adopter import implementations
+from grpc.beta import implementations
from grpc_interop import methods
from grpc_interop import resources
+from grpc_interop import test_pb2
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
@@ -46,19 +47,19 @@ def serve():
parser.add_argument(
'--port', help='the port on which to serve', type=int)
parser.add_argument(
- '--use_tls', help='require a secure connection', dest='use_tls',
- action='store_true')
+ '--use_tls', help='require a secure connection',
+ default=False, type=resources.parse_bool)
args = parser.parse_args()
+ server = test_pb2.beta_create_TestService_server(methods.TestService())
if args.use_tls:
private_key = resources.private_key()
certificate_chain = resources.certificate_chain()
- server = implementations.server(
- methods.SERVICE_NAME, methods.SERVER_METHODS, args.port,
- private_key=private_key, certificate_chain=certificate_chain)
+ credentials = implementations.ssl_server_credentials(
+ [(private_key, certificate_chain)])
+ server.add_secure_port('[::]:{}'.format(args.port), credentials)
else:
- server = implementations.server(
- methods.SERVICE_NAME, methods.SERVER_METHODS, args.port)
+ server.add_insecure_port('[::]:{}'.format(args.port))
server.start()
logging.info('Server serving.')