Tibor17 commented on a change in pull request #300: URL: https://github.com/apache/maven-surefire/pull/300#discussion_r437754132
########## File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/E2ETest.java ########## @@ -184,4 +195,70 @@ public void close() .isPositive() .isLessThanOrEqualTo( 6_000L ); } + + @Test( timeout = 10_000L ) + public void shouldAuthenticateClient() throws Exception + { + ForkNodeArguments forkNodeArguments = mock( ForkNodeArguments.class ); + when( forkNodeArguments.getSessionId() ).thenReturn( UUID.randomUUID().toString() ); + + try ( SurefireForkChannel server = new SurefireForkChannel( forkNodeArguments ); + SurefireMasterProcessChannelProcessorFactory client = new SurefireMasterProcessChannelProcessorFactory() ) + { + FutureTask<String> task = new FutureTask<>( new Callable<String>() + { + @Override + public String call() throws Exception + { + client.connect( server.getForkNodeConnectionString() ); + return "client connected"; + } + } ); + + Thread t = new Thread( task ); + t.setDaemon( true ); + t.start(); + + server.connectToClient(); + + assertThat( task.get() ) + .isEqualTo( "client connected" ); + } + } + + @Test( timeout = 10_000L ) + public void shouldNotAuthenticateClient() throws Exception + { + ForkNodeArguments forkNodeArguments = mock( ForkNodeArguments.class ); + String serverSessionId = UUID.randomUUID().toString(); + when( forkNodeArguments.getSessionId() ).thenReturn( serverSessionId ); + + try ( SurefireForkChannel server = new SurefireForkChannel( forkNodeArguments ); + SurefireMasterProcessChannelProcessorFactory client = new SurefireMasterProcessChannelProcessorFactory() ) + { + FutureTask<String> task = new FutureTask<>( new Callable<String>() + { + @Override + public String call() throws Exception + { + URI connectionString = new URI( server.getForkNodeConnectionString() ); Review comment: done ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org