SmtpRequestEncoderTest ByteBuf leak (#9075)

Motivation:
SmtpRequestEncoderTest#testThrowsIfContentExpected has a ByteBuf leak.

Modifications:
- SmtpRequestEncoderTest#testThrowsIfContentExpected should release buffers in a finally block

Result:
No more leaks in SmtpRequestEncoderTest#testThrowsIfContentExpected.
This commit is contained in:
Scott Mitchell 2019-04-18 23:47:02 -07:00 committed by Norman Maurer
parent 6248b2492b
commit 3579165d72

View File

@ -22,7 +22,9 @@ import io.netty.handler.codec.EncoderException;
import io.netty.util.CharsetUtil;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
public class SmtpRequestEncoderTest {
@ -92,8 +94,12 @@ public class SmtpRequestEncoderTest {
@Test(expected = EncoderException.class)
public void testThrowsIfContentExpected() {
EmbeddedChannel channel = new EmbeddedChannel(new SmtpRequestEncoder());
assertTrue(channel.writeOutbound(SmtpRequests.data()));
channel.writeOutbound(SmtpRequests.noop());
try {
assertTrue(channel.writeOutbound(SmtpRequests.data()));
channel.writeOutbound(SmtpRequests.noop());
} finally {
channel.finishAndReleaseAll();
}
}
@Test