Skip to content

Commit

Permalink
Merge pull request #188 from ennru/non-tls-client-java
Browse files Browse the repository at this point in the history
Add gRPC client without TLS test (Java)
  • Loading branch information
mergify[bot] authored Oct 1, 2020
2 parents 3e8d181 + b71360d commit d6b8207
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.hello.impl;

import akka.grpc.GrpcClientSettings;
import com.example.hello.api.HelloService;
import com.lightbend.lagom.javadsl.testkit.grpc.AkkaGrpcClientHelpers;
import example.myapp.helloworld.grpc.GreeterServiceClient;
Expand Down Expand Up @@ -43,4 +44,26 @@ public void shouldSayHelloUsingGrpc() throws Exception {
});
});
}

/**
* Illustrate deliberate use of the gRPC client without TLS.
*/
@Test
public void shouldSayHelloUsingGrpcNoSsl() throws Exception {
withServer(defaultSetup(), server -> {
GrpcClientSettings settings = GrpcClientSettings
.connectToServiceAt("127.0.0.1", server.port(), server.system())
.withTls(false);
GreeterServiceClient serviceClient = GreeterServiceClient.create(settings, server.system());

HelloRequest request =
HelloRequest.newBuilder().setName("Steve").build();
HelloReply reply = serviceClient
.sayHello(request)
.toCompletableFuture()
.get(5, SECONDS);
assertEquals("Hi Steve (gRPC)", reply.getMessage());
});
}

}

0 comments on commit d6b8207

Please sign in to comment.