@Test
public void handlerRemoved() throws Exception {

    OptionalSslHandler handler = new OptionalSslHandler(sslContext);
    final ByteBuf payload = Unpooled.copiedBuffer("plaintext".getBytes());
    try {
        handler.decode(context, payload, null);
        verify(pipeline).remove(handler);
    } finally {
        payload.release();
    }
}