diff --git a/src/main/java/com/epam/reportportal/util/test/SocketUtils.java b/src/main/java/com/epam/reportportal/util/test/SocketUtils.java index 1aec9a4..9df6fa4 100644 --- a/src/main/java/com/epam/reportportal/util/test/SocketUtils.java +++ b/src/main/java/com/epam/reportportal/util/test/SocketUtils.java @@ -96,14 +96,19 @@ public static ServerSocket getServerSocketOnFreePort() throws IOException { return new ServerSocket(0); } - public static Pair, T> executeServerCallable(ServerCallable srvCall, Callable clientCallable) throws Exception { + public static Pair, T> executeServerCallable(ServerCallable srvCall, Callable clientCallable, + long timeoutSeconds) throws Exception { ExecutorService serverExecutor = Executors.newSingleThreadExecutor(); Future> future = serverExecutor.submit(srvCall); T rs = clientCallable.call(); try { - return Pair.of(future.get(5, TimeUnit.SECONDS), rs); + return Pair.of(future.get(timeoutSeconds, TimeUnit.SECONDS), rs); } finally { CommonUtils.shutdownExecutorService(serverExecutor); } } + + public static Pair, T> executeServerCallable(ServerCallable srvCall, Callable clientCallable) throws Exception { + return executeServerCallable(srvCall, clientCallable, 5L); + } }