diff --git a/src/main/java/net/openhft/chronicle/map/TcpReplicator.java b/src/main/java/net/openhft/chronicle/map/TcpReplicator.java index ff2d068bc..0f35e9c28 100644 --- a/src/main/java/net/openhft/chronicle/map/TcpReplicator.java +++ b/src/main/java/net/openhft/chronicle/map/TcpReplicator.java @@ -1832,7 +1832,7 @@ class StatelessServerConnector { writeException(writer, e); - writeSizeAndFlags(sizeLocation + SIZE_OF_TRANSACTION_ID, true, writer.in()); + writeSizeAndFlags(sizeLocation , true, writer.in()); return null; } diff --git a/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java b/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java index e9b6fbc76..99215b307 100644 --- a/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java +++ b/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java @@ -205,6 +205,36 @@ public class StatelessClientTest { } + /** + * test that when the map is full and exception is thrown back to the user + * + * @throws IOException + * @throws InterruptedException + */ + @Test(timeout = 10000, expected = IllegalStateException.class) + public void testExceptionFromServer() throws IOException, InterruptedException { + int port = s_port++; + + final int size = 100; + + try (ChronicleMap serverMap = ChronicleMapBuilder + .of(Integer.class, CharSequence.class) + .entries(10) + .replication((byte) 2, TcpTransportAndNetworkConfig.of(port)) + .create()) { + try (ChronicleMap statelessMap = localClient(port)) { + + + for (int i = 0; i < size; i++) { + statelessMap.put(i, "hello"); + } + + assertEquals(statelessMap.size(), size); + + } + } + } + @Test public void testBufferOverFlowPutAllAndKeySet() throws IOException, InterruptedException { int port = 10 + s_port++;