This is an automated email from the ASF dual-hosted git repository.

maciej pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git


The following commit(s) were added to refs/heads/master by this push:
     new 92ed133b0 refactor(java): extract base integration test class (#2749)
92ed133b0 is described below

commit 92ed133b08d6f606df40f12f5fdead9d82049f1f
Author: Maciej Modzelewski <[email protected]>
AuthorDate: Tue Feb 17 09:59:25 2026 +0100

    refactor(java): extract base integration test class (#2749)
    
    Tests directly accessed container details (host, mapped ports)
    and the blocking IntegrationTest class owned all Testcontainers
    lifecycle, forcing async tests to extend it despite not needing
    its blocking-client scaffolding.
---
 .../apache/iggy/client/BaseIntegrationTest.java    |  87 ++++++++++++
 .../client/async/AsyncClientIntegrationTest.java   |   6 +-
 .../iggy/client/async/AsyncPollMessageTest.java    |   8 +-
 .../async/tcp/AsyncIggyTcpClientBuilderTest.java   | 146 +++++++++++++--------
 .../iggy/client/blocking/IntegrationTest.java      |  56 +-------
 .../http/ConsumerGroupsHttpClientTest.java         |   2 +-
 .../http/ConsumerOffsetsHttpClientTest.java        |   2 +-
 .../client/blocking/http/HttpClientFactory.java    |  15 +--
 .../blocking/http/MessagesHttpClientTest.java      |   2 +-
 .../blocking/http/PartitionsHttpClientTest.java    |   2 +-
 .../http/PersonalAccessTokensHttpClientTest.java   |   2 +-
 .../client/blocking/http/StreamHttpClientTest.java |   2 +-
 .../client/blocking/http/SystemHttpClientTest.java |   2 +-
 .../client/blocking/http/TopicsHttpClientTest.java |   2 +-
 .../client/blocking/http/UsersHttpClientTest.java  |   2 +-
 .../blocking/tcp/ConsumerGroupsTcpClientTest.java  |   2 +-
 .../blocking/tcp/ConsumerOffsetsTcpClientTest.java |   2 +-
 .../blocking/tcp/IggyTcpClientBuilderTest.java     |  44 +++----
 .../client/blocking/tcp/MessagesTcpClientTest.java |   2 +-
 .../blocking/tcp/PartitionsTcpClientTest.java      |   2 +-
 .../tcp/PersonalAccessTokensTcpClientTest.java     |   2 +-
 .../client/blocking/tcp/StreamTcpClientTest.java   |   2 +-
 .../client/blocking/tcp/SystemTcpClientTest.java   |   2 +-
 .../iggy/client/blocking/tcp/TcpClientFactory.java |  17 +--
 .../client/blocking/tcp/TopicsTcpClientTest.java   |   2 +-
 .../client/blocking/tcp/UsersTcpClientTest.java    |   2 +-
 26 files changed, 232 insertions(+), 183 deletions(-)

diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/BaseIntegrationTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/BaseIntegrationTest.java
new file mode 100644
index 000000000..bc8d6d8c0
--- /dev/null
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/BaseIntegrationTest.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iggy.client;
+
+import com.github.dockerjava.api.model.Capability;
+import com.github.dockerjava.api.model.Ulimit;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.junit.jupiter.Testcontainers;
+import org.testcontainers.utility.DockerImageName;
+
+import java.util.List;
+
+@Testcontainers
+public abstract class BaseIntegrationTest {
+
+    protected static GenericContainer<?> iggyServer;
+    private static final String LOCALHOST_IP = "127.0.0.1";
+    private static final int HTTP_PORT = 3000;
+    private static final int TCP_PORT = 8090;
+    private static final Logger log = 
LoggerFactory.getLogger(BaseIntegrationTest.class);
+    private static final boolean USE_EXTERNAL_SERVER = 
System.getenv("USE_EXTERNAL_SERVER") != null;
+
+    public static int serverTcpPort() {
+        return USE_EXTERNAL_SERVER ? TCP_PORT : 
iggyServer.getMappedPort(TCP_PORT);
+    }
+
+    public static int serverHttpPort() {
+        return USE_EXTERNAL_SERVER ? HTTP_PORT : 
iggyServer.getMappedPort(HTTP_PORT);
+    }
+
+    public static String serverHost() {
+        return USE_EXTERNAL_SERVER ? LOCALHOST_IP : iggyServer.getHost();
+    }
+
+    @BeforeAll
+    static void setupContainer() {
+        if (!USE_EXTERNAL_SERVER) {
+            log.info("Starting Iggy Server Container...");
+            iggyServer = new 
GenericContainer<>(DockerImageName.parse("apache/iggy:edge"))
+                    .withExposedPorts(HTTP_PORT, TCP_PORT)
+                    .withEnv("IGGY_ROOT_USERNAME", "iggy")
+                    .withEnv("IGGY_ROOT_PASSWORD", "iggy")
+                    .withEnv("IGGY_TCP_ADDRESS", "0.0.0.0:8090")
+                    .withEnv("IGGY_HTTP_ADDRESS", "0.0.0.0:3000")
+                    .withCreateContainerCmdModifier(cmd -> cmd.getHostConfig()
+                            .withCapAdd(Capability.SYS_NICE)
+                            .withSecurityOpts(List.of("seccomp:unconfined"))
+                            .withUlimits(List.of(new Ulimit("memlock", -1L, 
-1L))))
+                    .withLogConsumer(frame -> 
System.out.print(frame.getUtf8String()));
+            iggyServer.start();
+        } else {
+            log.info("Using external Iggy Server");
+        }
+    }
+
+    @AfterAll
+    static void stopContainer() {
+        if (iggyServer != null && iggyServer.isRunning()) {
+            // Print last logs before stopping
+            System.out.println("=== Iggy Server Container Logs ===");
+            System.out.println(iggyServer.getLogs());
+            System.out.println("=================================");
+            iggyServer.stop();
+        }
+    }
+}
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/AsyncClientIntegrationTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/AsyncClientIntegrationTest.java
index 41af17b60..f529cffc7 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/AsyncClientIntegrationTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/AsyncClientIntegrationTest.java
@@ -19,8 +19,8 @@
 
 package org.apache.iggy.client.async;
 
+import org.apache.iggy.client.BaseIntegrationTest;
 import org.apache.iggy.client.async.tcp.AsyncIggyTcpClient;
-import org.apache.iggy.client.blocking.IntegrationTest;
 import org.apache.iggy.consumergroup.Consumer;
 import org.apache.iggy.identifier.StreamId;
 import org.apache.iggy.identifier.TopicId;
@@ -53,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThat;
  * Tests connection, authentication, stream/topic management, and message 
operations.
  */
 @TestMethodOrder(MethodOrderer.OrderAnnotation.class)
-public abstract class AsyncClientIntegrationTest extends IntegrationTest {
+public class AsyncClientIntegrationTest extends BaseIntegrationTest {
     private static final Logger log = 
LoggerFactory.getLogger(AsyncClientIntegrationTest.class);
 
     private static final String USERNAME = "iggy";
@@ -68,7 +68,7 @@ public abstract class AsyncClientIntegrationTest extends 
IntegrationTest {
     @BeforeAll
     public static void setup() throws Exception {
         log.info("Setting up async client for integration tests");
-        client = new AsyncIggyTcpClient(LOCALHOST_IP, tcpPort());
+        client = new AsyncIggyTcpClient(serverHost(), serverTcpPort());
 
         // Connect and login
         client.connect()
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/AsyncPollMessageTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/AsyncPollMessageTest.java
index 18233e759..62011dd60 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/AsyncPollMessageTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/AsyncPollMessageTest.java
@@ -19,8 +19,8 @@
 
 package org.apache.iggy.client.async;
 
+import org.apache.iggy.client.BaseIntegrationTest;
 import org.apache.iggy.client.async.tcp.AsyncIggyTcpClient;
-import org.apache.iggy.client.blocking.IntegrationTest;
 import org.apache.iggy.consumergroup.Consumer;
 import org.apache.iggy.identifier.StreamId;
 import org.apache.iggy.identifier.TopicId;
@@ -58,7 +58,7 @@ import static org.assertj.core.api.Assertions.assertThat;
  * 3. Polling with valid consumer group member works correctly
  */
 @TestMethodOrder(MethodOrderer.OrderAnnotation.class)
-public abstract class AsyncPollMessageTest extends IntegrationTest {
+public abstract class AsyncPollMessageTest extends BaseIntegrationTest {
 
     private static final Logger log = 
LoggerFactory.getLogger(AsyncPollMessageTest.class);
     private static AsyncIggyTcpClient client;
@@ -80,7 +80,7 @@ public abstract class AsyncPollMessageTest extends 
IntegrationTest {
                     // Ignore close errors
                 }
             }
-            client = new AsyncIggyTcpClient(LOCALHOST_IP, tcpPort());
+            client = new AsyncIggyTcpClient(serverHost(), serverTcpPort());
             client.connect().get(5, TimeUnit.SECONDS);
             client.users().login("iggy", "iggy").get(5, TimeUnit.SECONDS);
             log.info("Client reconnected successfully");
@@ -102,7 +102,7 @@ public abstract class AsyncPollMessageTest extends 
IntegrationTest {
         log.info("Setting up async client for poll message tests");
 
         // Initialize client
-        client = new AsyncIggyTcpClient(LOCALHOST_IP, tcpPort());
+        client = new AsyncIggyTcpClient(serverHost(), serverTcpPort());
         client.connect().get(5, TimeUnit.SECONDS);
         client.users().login("iggy", "iggy").get(5, TimeUnit.SECONDS);
         log.info("Successfully connected and logged in");
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/tcp/AsyncIggyTcpClientBuilderTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/tcp/AsyncIggyTcpClientBuilderTest.java
index db8aa9bae..aa27421dd 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/tcp/AsyncIggyTcpClientBuilderTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/tcp/AsyncIggyTcpClientBuilderTest.java
@@ -19,8 +19,7 @@
 
 package org.apache.iggy.client.async.tcp;
 
-import org.apache.iggy.client.blocking.IggyBaseClient;
-import org.apache.iggy.client.blocking.IntegrationTest;
+import org.apache.iggy.client.BaseIntegrationTest;
 import org.apache.iggy.config.RetryPolicy;
 import org.apache.iggy.exception.IggyInvalidArgumentException;
 import org.apache.iggy.exception.IggyMissingCredentialsException;
@@ -42,7 +41,7 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue;
  * Integration tests for AsyncIggyTcpClient builder pattern.
  * Tests the builder functionality against a running Iggy server.
  */
-class AsyncIggyTcpClientBuilderTest extends IntegrationTest {
+class AsyncIggyTcpClientBuilderTest extends BaseIntegrationTest {
 
     private static final String TEST_USERNAME = "iggy";
     private static final String TEST_PASSWORD = "iggy";
@@ -60,7 +59,10 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest {
     @Test
     void shouldCreateClientWithBuilder() throws Exception {
         // Given: Builder with basic configuration
-        client = 
AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(tcpPort()).build();
+        client = AsyncIggyTcpClient.builder()
+                .host(serverHost())
+                .port(serverTcpPort())
+                .build();
 
         // When: Connect to server
         client.connect().get(TEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -94,7 +96,7 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest {
     void shouldThrowExceptionForEmptyHost() {
         // Given: Builder with empty host
         AsyncIggyTcpClientBuilder builder =
-                AsyncIggyTcpClient.builder().host("").port(TCP_PORT);
+                AsyncIggyTcpClient.builder().host("").port(serverTcpPort());
 
         // When/Then: Building should throw IggyInvalidArgumentException
         assertThrows(IggyInvalidArgumentException.class, builder::build);
@@ -104,7 +106,7 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     void shouldThrowExceptionForNullHost() {
         // Given: Builder with null host
         AsyncIggyTcpClientBuilder builder =
-                AsyncIggyTcpClient.builder().host(null).port(TCP_PORT);
+                AsyncIggyTcpClient.builder().host(null).port(serverTcpPort());
 
         // When/Then: Building should throw IggyInvalidArgumentException
         assertThrows(IggyInvalidArgumentException.class, builder::build);
@@ -114,7 +116,7 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     void shouldThrowExceptionForInvalidPort() {
         // Given: Builder with invalid port
         AsyncIggyTcpClientBuilder builder =
-                AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(-1);
+                AsyncIggyTcpClient.builder().host(serverHost()).port(-1);
 
         // When/Then: Building should throw IggyInvalidArgumentException
         assertThrows(IggyInvalidArgumentException.class, builder::build);
@@ -124,7 +126,7 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     void shouldThrowExceptionForZeroPort() {
         // Given: Builder with zero port
         AsyncIggyTcpClientBuilder builder =
-                AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(0);
+                AsyncIggyTcpClient.builder().host(serverHost()).port(0);
 
         // When/Then: Building should throw IggyInvalidArgumentException
         assertThrows(IggyInvalidArgumentException.class, builder::build);
@@ -133,7 +135,7 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     @Test
     void shouldMaintainBackwardCompatibilityWithOldConstructor() throws 
Exception {
         // Given: Old constructor approach
-        client = new AsyncIggyTcpClient(LOCALHOST_IP, tcpPort());
+        client = new AsyncIggyTcpClient(serverHost(), serverTcpPort());
 
         // When: Connect to server
         client.connect().get(TEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -145,7 +147,10 @@ class AsyncIggyTcpClientBuilderTest extends 
IntegrationTest {
     @Test
     void shouldConnectAndPerformOperations() throws Exception {
         // Given: Client
-        client = 
AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(tcpPort()).build();
+        client = AsyncIggyTcpClient.builder()
+                .host(serverHost())
+                .port(serverTcpPort())
+                .build();
 
         // When: Connect
         client.connect().get(TEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -161,7 +166,10 @@ class AsyncIggyTcpClientBuilderTest extends 
IntegrationTest {
     @Test
     void shouldCloseConnectionGracefully() throws Exception {
         // Given: Connected client
-        client = 
AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(tcpPort()).build();
+        client = AsyncIggyTcpClient.builder()
+                .host(serverHost())
+                .port(serverTcpPort())
+                .build();
         client.connect().get(5, TimeUnit.SECONDS);
 
         // When: Close connection
@@ -176,8 +184,8 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     @Test
     void testThrowExceptionWhenLoginBeforeConnect() {
         client = AsyncIggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(TCP_PORT)
+                .host(serverHost())
+                .port(serverTcpPort())
                 .credentials(TEST_USERNAME, TEST_PASSWORD)
                 .build();
 
@@ -186,42 +194,60 @@ class AsyncIggyTcpClientBuilderTest extends 
IntegrationTest {
 
     @Test
     void testThrowExceptionWhenAccessingUsersBeforeConnect() {
-        client = 
AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(TCP_PORT).build();
+        client = AsyncIggyTcpClient.builder()
+                .host(serverHost())
+                .port(serverTcpPort())
+                .build();
 
         assertThrows(IggyNotConnectedException.class, () -> client.users());
     }
 
     @Test
     void testThrowExceptionWhenAccessingMessagesBeforeConnect() {
-        client = 
AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(TCP_PORT).build();
+        client = AsyncIggyTcpClient.builder()
+                .host(serverHost())
+                .port(serverTcpPort())
+                .build();
 
         assertThrows(IggyNotConnectedException.class, () -> client.messages());
     }
 
     @Test
     void testThrowExceptionWhenAccessingStreamsBeforeConnect() {
-        client = 
AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(TCP_PORT).build();
+        client = AsyncIggyTcpClient.builder()
+                .host(serverHost())
+                .port(serverTcpPort())
+                .build();
 
         assertThrows(IggyNotConnectedException.class, () -> client.streams());
     }
 
     @Test
     void testThrowExceptionWhenAccessingTopicsBeforeConnect() {
-        client = 
AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(TCP_PORT).build();
+        client = AsyncIggyTcpClient.builder()
+                .host(serverHost())
+                .port(serverTcpPort())
+                .build();
 
         assertThrows(IggyNotConnectedException.class, () -> client.topics());
     }
 
     @Test
     void testThrowExceptionWhenAccessingConsumerGroupsBeforeConnect() {
-        client = 
AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(TCP_PORT).build();
+        client = AsyncIggyTcpClient.builder()
+                .host(serverHost())
+                .port(serverTcpPort())
+                .build();
 
         assertThrows(IggyNotConnectedException.class, () -> 
client.consumerGroups());
     }
 
     @Test
     void testThrowExceptionWhenLoginWithoutCredentials() throws Exception {
-        client = 
AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(tcpPort()).build();
+        client = AsyncIggyTcpClient.builder()
+                .host(serverHost())
+                .port(serverTcpPort())
+                .build();
         client.connect().get(5, TimeUnit.SECONDS);
 
         assertThrows(IggyMissingCredentialsException.class, () -> 
client.login());
@@ -230,23 +256,27 @@ class AsyncIggyTcpClientBuilderTest extends 
IntegrationTest {
     @Test
     void testThrowExceptionWhenBuildAndLoginWithoutCredentials() {
         AsyncIggyTcpClientBuilder builder =
-                AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(TCP_PORT);
+                
AsyncIggyTcpClient.builder().host(serverHost()).port(serverTcpPort());
 
         assertThrows(IggyMissingCredentialsException.class, 
builder::buildAndLogin);
     }
 
     @Test
     void testThrowExceptionWhenBuildAndLoginWithNullUsername() {
-        AsyncIggyTcpClientBuilder builder =
-                
AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(TCP_PORT).credentials(null,
 TEST_PASSWORD);
+        AsyncIggyTcpClientBuilder builder = AsyncIggyTcpClient.builder()
+                .host(serverHost())
+                .port(serverTcpPort())
+                .credentials(null, TEST_PASSWORD);
 
         assertThrows(IggyMissingCredentialsException.class, 
builder::buildAndLogin);
     }
 
     @Test
     void testThrowExceptionWhenBuildAndLoginWithNullPassword() {
-        AsyncIggyTcpClientBuilder builder =
-                
AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(TCP_PORT).credentials(TEST_USERNAME,
 null);
+        AsyncIggyTcpClientBuilder builder = AsyncIggyTcpClient.builder()
+                .host(serverHost())
+                .port(serverTcpPort())
+                .credentials(TEST_USERNAME, null);
 
         assertThrows(IggyMissingCredentialsException.class, 
builder::buildAndLogin);
     }
@@ -254,8 +284,8 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     @Test
     void testBuildClientWithCredentials() throws Exception {
         client = AsyncIggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .credentials(TEST_USERNAME, TEST_PASSWORD)
                 .build();
         client.connect().get(TEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -266,8 +296,8 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     @Test
     void testBuildClientWithConnectionTimeout() throws Exception {
         client = AsyncIggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .connectionTimeout(Duration.ofSeconds(10))
                 .build();
         client.connect().get(TEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -278,8 +308,8 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     @Test
     void testBuildClientWithRequestTimeout() throws Exception {
         client = AsyncIggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .requestTimeout(Duration.ofSeconds(30))
                 .build();
         client.connect().get(TEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -290,8 +320,8 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     @Test
     void testBuildClientWithConnectionPoolSize() throws Exception {
         client = AsyncIggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .connectionPoolSize(5)
                 .build();
         client.connect().get(TEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -302,8 +332,8 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     @Test
     void testBuildClientWithExponentialBackoffRetryPolicy() throws Exception {
         client = AsyncIggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .retryPolicy(RetryPolicy.exponentialBackoff())
                 .build();
         client.connect().get(TEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -314,8 +344,8 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     @Test
     void testBuildClientWithFixedDelayRetryPolicy() throws Exception {
         client = AsyncIggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .retryPolicy(RetryPolicy.fixedDelay(3, Duration.ofMillis(100)))
                 .build();
         client.connect().get(TEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -326,8 +356,8 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     @Test
     void testBuildClientWithNoRetryPolicy() throws Exception {
         client = AsyncIggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .retryPolicy(RetryPolicy.noRetry())
                 .build();
         client.connect().get(TEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -338,8 +368,8 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     @Test
     void testBuildClientWithTlsBoolean() throws Exception {
         client = AsyncIggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .tls(false)
                 .build();
         client.connect().get(TEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -350,8 +380,8 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     @Test
     void testBuildClientWithEnableTls() throws Exception {
         client = AsyncIggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(TCP_PORT)
+                .host(serverHost())
+                .port(serverTcpPort())
                 .enableTls()
                 .build();
 
@@ -361,8 +391,8 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     @Test
     void testBuildClientWithAllConfigurationOptions() throws Exception {
         client = AsyncIggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .credentials(TEST_USERNAME, TEST_PASSWORD)
                 .connectionTimeout(Duration.ofSeconds(10))
                 .requestTimeout(Duration.ofSeconds(30))
@@ -382,8 +412,8 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     @Test
     void testBuildAndLoginSuccessfully() throws Exception {
         client = AsyncIggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .credentials(TEST_USERNAME, TEST_PASSWORD)
                 .buildAndLogin()
                 .get(TEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -397,7 +427,10 @@ class AsyncIggyTcpClientBuilderTest extends 
IntegrationTest {
 
     @Test
     void testHandleCloseOnUnconnectedClient() throws Exception {
-        client = 
AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(TCP_PORT).build();
+        client = AsyncIggyTcpClient.builder()
+                .host(serverHost())
+                .port(serverTcpPort())
+                .build();
 
         CompletableFuture<Void> closeFuture = client.close();
         closeFuture.get(TEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
@@ -408,7 +441,10 @@ class AsyncIggyTcpClientBuilderTest extends 
IntegrationTest {
 
     @Test
     void testHandleMultipleCloseCalls() throws Exception {
-        client = 
AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(tcpPort()).build();
+        client = AsyncIggyTcpClient.builder()
+                .host(serverHost())
+                .port(serverTcpPort())
+                .build();
         client.connect().get(5, TimeUnit.SECONDS);
 
         CompletableFuture<Void> firstClose = client.close();
@@ -446,8 +482,8 @@ class AsyncIggyTcpClientBuilderTest extends IntegrationTest 
{
     @Test
     void testBuildConnectAndLoginManually() throws Exception {
         client = AsyncIggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .credentials(TEST_USERNAME, TEST_PASSWORD)
                 .build();
 
@@ -459,16 +495,14 @@ class AsyncIggyTcpClientBuilderTest extends 
IntegrationTest {
 
     @Test
     void testBuildAndConnectWithoutCredentialsThenLoginExplicitly() throws 
Exception {
-        client = 
AsyncIggyTcpClient.builder().host(LOCALHOST_IP).port(tcpPort()).build();
+        client = AsyncIggyTcpClient.builder()
+                .host(serverHost())
+                .port(serverTcpPort())
+                .build();
 
         client.connect().get(5, TimeUnit.SECONDS);
         client.users().login(TEST_USERNAME, 
TEST_PASSWORD).get(TEST_TIMEOUT_SECONDS, TimeUnit.SECONDS);
 
         assertNotNull(client.users());
     }
-
-    @Override
-    protected IggyBaseClient getClient() {
-        return null;
-    }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/IntegrationTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/IntegrationTest.java
index c539d8e16..c41b0f75a 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/IntegrationTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/IntegrationTest.java
@@ -19,19 +19,11 @@
 
 package org.apache.iggy.client.blocking;
 
-import com.github.dockerjava.api.model.Capability;
-import com.github.dockerjava.api.model.Ulimit;
+import org.apache.iggy.client.BaseIntegrationTest;
 import org.apache.iggy.stream.StreamDetails;
 import org.apache.iggy.topic.CompressionAlgorithm;
-import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.BeforeEach;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testcontainers.containers.GenericContainer;
-import org.testcontainers.junit.jupiter.Testcontainers;
-import org.testcontainers.utility.DockerImageName;
 
 import java.math.BigInteger;
 import java.util.ArrayList;
@@ -41,57 +33,13 @@ import static java.util.Optional.empty;
 import static org.apache.iggy.TestConstants.STREAM_NAME;
 import static org.apache.iggy.TestConstants.TOPIC_NAME;
 
-@Testcontainers
-public abstract class IntegrationTest {
-
-    public static final String LOCALHOST_IP = "127.0.0.1";
-    public static final int HTTP_PORT = 3000;
-    public static final int TCP_PORT = 8090;
-    protected static GenericContainer<?> iggyServer;
-    private static final Logger log = 
LoggerFactory.getLogger(IntegrationTest.class);
-    private static final boolean USE_EXTERNAL_SERVER = 
System.getenv("USE_EXTERNAL_SERVER") != null;
+public abstract class IntegrationTest extends BaseIntegrationTest {
 
     // Track created resources for cleanup
     protected List<Long> createdStreamIds = new ArrayList<>();
     protected List<Long> createdUserIds = new ArrayList<>();
     protected IggyBaseClient client;
 
-    public static int tcpPort() {
-        return USE_EXTERNAL_SERVER ? TCP_PORT : 
iggyServer.getMappedPort(TCP_PORT);
-    }
-
-    @BeforeAll
-    static void setupContainer() {
-        if (!USE_EXTERNAL_SERVER) {
-            log.info("Starting Iggy Server Container...");
-            iggyServer = new 
GenericContainer<>(DockerImageName.parse("apache/iggy:edge"))
-                    .withExposedPorts(HTTP_PORT, TCP_PORT)
-                    .withEnv("IGGY_ROOT_USERNAME", "iggy")
-                    .withEnv("IGGY_ROOT_PASSWORD", "iggy")
-                    .withEnv("IGGY_TCP_ADDRESS", "0.0.0.0:8090")
-                    .withEnv("IGGY_HTTP_ADDRESS", "0.0.0.0:3000")
-                    .withCreateContainerCmdModifier(cmd -> cmd.getHostConfig()
-                            .withCapAdd(Capability.SYS_NICE)
-                            .withSecurityOpts(List.of("seccomp:unconfined"))
-                            .withUlimits(List.of(new Ulimit("memlock", -1L, 
-1L))))
-                    .withLogConsumer(frame -> 
System.out.print(frame.getUtf8String()));
-            iggyServer.start();
-        } else {
-            log.info("Using external Iggy Server");
-        }
-    }
-
-    @AfterAll
-    static void stopContainer() {
-        if (iggyServer != null && iggyServer.isRunning()) {
-            // Print last logs before stopping
-            System.out.println("=== Iggy Server Container Logs ===");
-            System.out.println(iggyServer.getLogs());
-            System.out.println("=================================");
-            iggyServer.stop();
-        }
-    }
-
     @BeforeEach
     void beforeEachIntegrationTest() {
         client = getClient();
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/ConsumerGroupsHttpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/ConsumerGroupsHttpClientTest.java
index 538f3d913..64db4e016 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/ConsumerGroupsHttpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/ConsumerGroupsHttpClientTest.java
@@ -26,6 +26,6 @@ class ConsumerGroupsHttpClientTest extends 
ConsumerGroupsClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return HttpClientFactory.create(iggyServer);
+        return HttpClientFactory.create(serverHost(), serverHttpPort());
     }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/ConsumerOffsetsHttpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/ConsumerOffsetsHttpClientTest.java
index deec22dc6..f2a7b3dfa 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/ConsumerOffsetsHttpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/ConsumerOffsetsHttpClientTest.java
@@ -26,6 +26,6 @@ class ConsumerOffsetsHttpClientTest extends 
ConsumerOffsetsClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return HttpClientFactory.create(iggyServer);
+        return HttpClientFactory.create(serverHost(), serverHttpPort());
     }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/HttpClientFactory.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/HttpClientFactory.java
index 6f17c9ac6..842048b66 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/HttpClientFactory.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/HttpClientFactory.java
@@ -19,22 +19,13 @@
 
 package org.apache.iggy.client.blocking.http;
 
-import org.testcontainers.containers.GenericContainer;
-
-import static org.apache.iggy.client.blocking.IntegrationTest.HTTP_PORT;
-import static org.apache.iggy.client.blocking.IntegrationTest.LOCALHOST_IP;
+import org.apache.iggy.Iggy;
 
 final class HttpClientFactory {
 
     private HttpClientFactory() {}
 
-    static IggyHttpClient create(GenericContainer<?> iggyServer) {
-        if (iggyServer == null) {
-            // Server is running externally
-            return new IggyHttpClient("http://"; + LOCALHOST_IP + ":" + 
HTTP_PORT);
-        }
-        String address = iggyServer.getHost();
-        Integer port = iggyServer.getMappedPort(HTTP_PORT);
-        return new IggyHttpClient("http://"; + address + ":" + port);
+    static IggyHttpClient create(String host, int port) {
+        return 
Iggy.httpClientBuilder().blocking().host(host).port(port).build();
     }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/MessagesHttpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/MessagesHttpClientTest.java
index 5e4521e5a..30459db0b 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/MessagesHttpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/MessagesHttpClientTest.java
@@ -26,6 +26,6 @@ class MessagesHttpClientTest extends MessagesClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return HttpClientFactory.create(iggyServer);
+        return HttpClientFactory.create(serverHost(), serverHttpPort());
     }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/PartitionsHttpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/PartitionsHttpClientTest.java
index 9330eac25..03dbb918b 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/PartitionsHttpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/PartitionsHttpClientTest.java
@@ -26,6 +26,6 @@ class PartitionsHttpClientTest extends 
PartitionsClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return HttpClientFactory.create(iggyServer);
+        return HttpClientFactory.create(serverHost(), serverHttpPort());
     }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/PersonalAccessTokensHttpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/PersonalAccessTokensHttpClientTest.java
index 6ea9c085b..f6bc8011a 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/PersonalAccessTokensHttpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/PersonalAccessTokensHttpClientTest.java
@@ -26,6 +26,6 @@ class PersonalAccessTokensHttpClientTest extends 
PersonalAccessTokensBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return HttpClientFactory.create(iggyServer);
+        return HttpClientFactory.create(serverHost(), serverHttpPort());
     }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/StreamHttpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/StreamHttpClientTest.java
index 0368d2664..30ae81b5c 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/StreamHttpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/StreamHttpClientTest.java
@@ -26,6 +26,6 @@ class StreamHttpClientTest extends StreamClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return HttpClientFactory.create(iggyServer);
+        return HttpClientFactory.create(serverHost(), serverHttpPort());
     }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/SystemHttpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/SystemHttpClientTest.java
index 4e8610428..acff8a2b0 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/SystemHttpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/SystemHttpClientTest.java
@@ -26,6 +26,6 @@ class SystemHttpClientTest extends SystemClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return HttpClientFactory.create(iggyServer);
+        return HttpClientFactory.create(serverHost(), serverHttpPort());
     }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/TopicsHttpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/TopicsHttpClientTest.java
index 603c4499c..74d23669a 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/TopicsHttpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/TopicsHttpClientTest.java
@@ -26,6 +26,6 @@ class TopicsHttpClientTest extends TopicsClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return HttpClientFactory.create(iggyServer);
+        return HttpClientFactory.create(serverHost(), serverHttpPort());
     }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/UsersHttpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/UsersHttpClientTest.java
index 92bc68735..a180cc0c2 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/UsersHttpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/http/UsersHttpClientTest.java
@@ -29,7 +29,7 @@ class UsersHttpClientTest extends UsersClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return HttpClientFactory.create(iggyServer);
+        return HttpClientFactory.create(serverHost(), serverHttpPort());
     }
 
     @Test
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/ConsumerGroupsTcpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/ConsumerGroupsTcpClientTest.java
index e9c458177..9ed756555 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/ConsumerGroupsTcpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/ConsumerGroupsTcpClientTest.java
@@ -32,7 +32,7 @@ class ConsumerGroupsTcpClientTest extends 
ConsumerGroupsClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return TcpClientFactory.create(iggyServer);
+        return TcpClientFactory.create(serverHost(), serverTcpPort());
     }
 
     @Test
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/ConsumerOffsetsTcpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/ConsumerOffsetsTcpClientTest.java
index 4676ed555..be8547431 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/ConsumerOffsetsTcpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/ConsumerOffsetsTcpClientTest.java
@@ -26,6 +26,6 @@ class ConsumerOffsetsTcpClientTest extends 
ConsumerOffsetsClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return TcpClientFactory.create(iggyServer);
+        return TcpClientFactory.create(serverHost(), serverTcpPort());
     }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/IggyTcpClientBuilderTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/IggyTcpClientBuilderTest.java
index 433336906..b2e523975 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/IggyTcpClientBuilderTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/IggyTcpClientBuilderTest.java
@@ -41,15 +41,15 @@ class IggyTcpClientBuilderTest extends IntegrationTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return TcpClientFactory.create(iggyServer);
+        return TcpClientFactory.create(serverHost(), serverTcpPort());
     }
 
     @Test
     void shouldCreateClientWithBuilder() {
         // Given: Builder with basic configuration and credentials
         IggyTcpClient client = IggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .credentials("iggy", "iggy")
                 .buildAndLogin();
 
@@ -62,8 +62,8 @@ class IggyTcpClientBuilderTest extends IntegrationTest {
     void shouldCreateClientWithCredentials() {
         // Given: Builder with credentials configured
         IggyTcpClient client = IggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .credentials("iggy", "iggy")
                 .buildAndLogin();
 
@@ -77,8 +77,8 @@ class IggyTcpClientBuilderTest extends IntegrationTest {
     void shouldCreateClientWithTimeoutConfiguration() {
         // Given: Builder with timeout configuration
         IggyTcpClient client = IggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .connectionTimeout(Duration.ofSeconds(30))
                 .requestTimeout(Duration.ofSeconds(10))
                 .credentials("iggy", "iggy")
@@ -93,8 +93,8 @@ class IggyTcpClientBuilderTest extends IntegrationTest {
     void shouldCreateClientWithConnectionPoolSize() {
         // Given: Builder with connection pool size
         IggyTcpClient client = IggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .connectionPoolSize(10)
                 .credentials("iggy", "iggy")
                 .buildAndLogin();
@@ -108,8 +108,8 @@ class IggyTcpClientBuilderTest extends IntegrationTest {
     void shouldCreateClientWithRetryPolicy() {
         // Given: Builder with exponential backoff retry policy
         IggyTcpClient client = IggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .retryPolicy(RetryPolicy.exponentialBackoff())
                 .credentials("iggy", "iggy")
                 .buildAndLogin();
@@ -123,8 +123,8 @@ class IggyTcpClientBuilderTest extends IntegrationTest {
     void shouldCreateClientWithCustomRetryPolicy() {
         // Given: Builder with custom retry policy
         IggyTcpClient client = IggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .retryPolicy(RetryPolicy.fixedDelay(5, Duration.ofMillis(500)))
                 .credentials("iggy", "iggy")
                 .buildAndLogin();
@@ -138,8 +138,8 @@ class IggyTcpClientBuilderTest extends IntegrationTest {
     void shouldCreateClientWithNoRetryPolicy() {
         // Given: Builder with no retry policy
         IggyTcpClient client = IggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .retryPolicy(RetryPolicy.noRetry())
                 .credentials("iggy", "iggy")
                 .buildAndLogin();
@@ -153,8 +153,8 @@ class IggyTcpClientBuilderTest extends IntegrationTest {
     void shouldCreateClientWithAllOptions() {
         // Given: Builder with all configuration options
         IggyTcpClient client = IggyTcpClient.builder()
-                .host(LOCALHOST_IP)
-                .port(tcpPort())
+                .host(serverHost())
+                .port(serverTcpPort())
                 .connectionTimeout(Duration.ofSeconds(30))
                 .requestTimeout(Duration.ofSeconds(10))
                 .connectionPoolSize(10)
@@ -186,7 +186,7 @@ class IggyTcpClientBuilderTest extends IntegrationTest {
     @Test
     void shouldThrowExceptionForEmptyHost() {
         // Given: Builder with empty host
-        IggyTcpClientBuilder builder = 
IggyTcpClient.builder().host("").port(TCP_PORT);
+        IggyTcpClientBuilder builder = 
IggyTcpClient.builder().host("").port(serverTcpPort());
 
         // When/Then: Building should throw IggyInvalidArgumentException
         assertThrows(IggyInvalidArgumentException.class, builder::build);
@@ -195,7 +195,7 @@ class IggyTcpClientBuilderTest extends IntegrationTest {
     @Test
     void shouldThrowExceptionForNullHost() {
         // Given: Builder with null host
-        IggyTcpClientBuilder builder = 
IggyTcpClient.builder().host(null).port(TCP_PORT);
+        IggyTcpClientBuilder builder = 
IggyTcpClient.builder().host(null).port(serverTcpPort());
 
         // When/Then: Building should throw IggyInvalidArgumentException
         assertThrows(IggyInvalidArgumentException.class, builder::build);
@@ -205,7 +205,7 @@ class IggyTcpClientBuilderTest extends IntegrationTest {
     void shouldThrowExceptionForInvalidPort() {
         // Given: Builder with invalid port
         IggyTcpClientBuilder builder =
-                IggyTcpClient.builder().host(LOCALHOST_IP).port(-1);
+                IggyTcpClient.builder().host(serverHost()).port(-1);
 
         // When/Then: Building should throw IggyInvalidArgumentException
         assertThrows(IggyInvalidArgumentException.class, builder::build);
@@ -215,7 +215,7 @@ class IggyTcpClientBuilderTest extends IntegrationTest {
     void shouldThrowExceptionForZeroPort() {
         // Given: Builder with zero port
         IggyTcpClientBuilder builder =
-                IggyTcpClient.builder().host(LOCALHOST_IP).port(0);
+                IggyTcpClient.builder().host(serverHost()).port(0);
 
         // When/Then: Building should throw IggyInvalidArgumentException
         assertThrows(IggyInvalidArgumentException.class, builder::build);
@@ -224,7 +224,7 @@ class IggyTcpClientBuilderTest extends IntegrationTest {
     @Test
     void shouldWorkWithConstructorAndExplicitConnect() {
         // Given: Constructor approach with explicit connect
-        IggyTcpClient client = new IggyTcpClient(LOCALHOST_IP, tcpPort());
+        IggyTcpClient client = new IggyTcpClient(serverHost(), 
serverTcpPort());
 
         // When: Connect, login and perform operation
         client.connect();
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/MessagesTcpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/MessagesTcpClientTest.java
index 7b14f24c0..aabdf19e0 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/MessagesTcpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/MessagesTcpClientTest.java
@@ -26,6 +26,6 @@ class MessagesTcpClientTest extends MessagesClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return TcpClientFactory.create(iggyServer);
+        return TcpClientFactory.create(serverHost(), serverTcpPort());
     }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/PartitionsTcpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/PartitionsTcpClientTest.java
index 763754ddb..67de7fa82 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/PartitionsTcpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/PartitionsTcpClientTest.java
@@ -26,6 +26,6 @@ class PartitionsTcpClientTest extends 
PartitionsClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return TcpClientFactory.create(iggyServer);
+        return TcpClientFactory.create(serverHost(), serverTcpPort());
     }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/PersonalAccessTokensTcpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/PersonalAccessTokensTcpClientTest.java
index c40857c5d..c2e4cc874 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/PersonalAccessTokensTcpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/PersonalAccessTokensTcpClientTest.java
@@ -26,6 +26,6 @@ class PersonalAccessTokensTcpClientTest extends 
PersonalAccessTokensBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return TcpClientFactory.create(iggyServer);
+        return TcpClientFactory.create(serverHost(), serverTcpPort());
     }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/StreamTcpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/StreamTcpClientTest.java
index ac490c088..a3954f189 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/StreamTcpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/StreamTcpClientTest.java
@@ -26,6 +26,6 @@ class StreamTcpClientTest extends StreamClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return TcpClientFactory.create(iggyServer);
+        return TcpClientFactory.create(serverHost(), serverTcpPort());
     }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/SystemTcpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/SystemTcpClientTest.java
index e752a48c0..db00a876f 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/SystemTcpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/SystemTcpClientTest.java
@@ -33,7 +33,7 @@ class SystemTcpClientTest extends SystemClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return TcpClientFactory.create(iggyServer);
+        return TcpClientFactory.create(serverHost(), serverTcpPort());
     }
 
     @Test
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/TcpClientFactory.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/TcpClientFactory.java
index d7be63057..cac9f02e5 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/TcpClientFactory.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/TcpClientFactory.java
@@ -19,25 +19,14 @@
 
 package org.apache.iggy.client.blocking.tcp;
 
-import org.testcontainers.containers.GenericContainer;
-
-import static org.apache.iggy.client.blocking.IntegrationTest.LOCALHOST_IP;
-import static org.apache.iggy.client.blocking.IntegrationTest.TCP_PORT;
+import org.apache.iggy.Iggy;
 
 final class TcpClientFactory {
 
     private TcpClientFactory() {}
 
-    static IggyTcpClient create(GenericContainer<?> iggyServer) {
-        IggyTcpClient client;
-        if (iggyServer == null) {
-            // Server is running externally
-            client = new IggyTcpClient(LOCALHOST_IP, TCP_PORT);
-        } else {
-            String address = iggyServer.getHost();
-            Integer port = iggyServer.getMappedPort(TCP_PORT);
-            client = new IggyTcpClient(address, port);
-        }
+    static IggyTcpClient create(String host, int port) {
+        var client = 
Iggy.tcpClientBuilder().blocking().host(host).port(port).build();
         client.connect();
         return client;
     }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/TopicsTcpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/TopicsTcpClientTest.java
index 926fb9782..6e5e80f14 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/TopicsTcpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/TopicsTcpClientTest.java
@@ -26,6 +26,6 @@ class TopicsTcpClientTest extends TopicsClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return TcpClientFactory.create(iggyServer);
+        return TcpClientFactory.create(serverHost(), serverTcpPort());
     }
 }
diff --git 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/UsersTcpClientTest.java
 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/UsersTcpClientTest.java
index 5066b0eb8..3745aeb4b 100644
--- 
a/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/UsersTcpClientTest.java
+++ 
b/foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/tcp/UsersTcpClientTest.java
@@ -30,7 +30,7 @@ class UsersTcpClientTest extends UsersClientBaseTest {
 
     @Override
     protected IggyBaseClient getClient() {
-        return TcpClientFactory.create(iggyServer);
+        return TcpClientFactory.create(serverHost(), serverTcpPort());
     }
 
     @BeforeEach

Reply via email to