Skip to content

Commit cb8d7e4

Browse files
author
igor_bolotin
committed
Test fix
1 parent aedea1f commit cb8d7e4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/test/java/com/rabbitmq/client/test/functional/FrameMax.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,23 @@ public FrameMax() {
121121

122122
Map<String, Object> headers = new HashMap<String, Object>();
123123
String headerName = "x-huge-header";
124-
headers.put(headerName, "");
124+
headers.put(headerName, LongStringHelper.asLongString(new byte[0]));
125125

126126
AMQP.BasicProperties properties = new AMQP.BasicProperties.Builder().headers(headers).build();
127127

128128
ByteArrayOutputStream baos = new ByteArrayOutputStream();
129-
properties.writePropertiesTo(new ContentHeaderPropertyWriter(new DataOutputStream(baos)));
130-
int overhead = baos.size();
129+
DataOutputStream dos = new DataOutputStream(baos);
130+
properties.writePropertiesTo(new ContentHeaderPropertyWriter(dos));
131+
dos.flush();
132+
int overhead = baos.size() + 12;
131133

132134
headers.put(headerName, LongStringHelper.asLongString(new byte[REAL_FRAME_MAX - overhead]));
135+
properties = new AMQP.BasicProperties.Builder().headers(headers).build();
133136

134137
basicPublishVolatile(new byte[100], "x", "foobar", properties);
135138
assertDelivered(queueName, 1);
136139

137-
headers.put(headerName, LongStringHelper.asLongString(new byte[REAL_FRAME_MAX - overhead - 1]));
140+
headers.put(headerName, LongStringHelper.asLongString(new byte[REAL_FRAME_MAX - overhead + 1]));
138141
properties = new AMQP.BasicProperties.Builder().headers(headers).build();
139142

140143
try {

0 commit comments

Comments
 (0)