1 package dst.ass2.service.auth.tests;
3 import java.net.Socket;
6 import org.junit.runner.RunWith;
7 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory;
9 import org.springframework.beans.factory.annotation.Value;
10 import org.springframework.boot.test.context.SpringBootTest;
11 import org.springframework.test.context.junit4.SpringRunner;
13 import dst.ass2.service.auth.AuthenticationServiceApplication;
15 @RunWith(SpringRunner.class)
16 @SpringBootTest(classes = AuthenticationServiceApplication.class)
17 public class GrpcServerRunnerTest {
19 private static final Logger LOG = LoggerFactory.getLogger(GrpcServerRunnerTest.class);
21 @Value("${grpc.port}")
25 public void canConnectToGrpcSocketAfterApplicationInitialization() throws Exception {
29 LOG.info("Tyring to connect to TCP socket on localhost:{}", port);
30 try (Socket socket = new Socket("localhost", port)) {
32 } catch (Exception e) {
34 throw new AssertionError("Expected gRPC server to run on port " + port, e);