#fixed code
                                @Test
    public void shouldUseSameBody() throws IOException {
        unit.getOutputStream().write("test".getBytes());

        final byte[] body1 = unit.getBody();
        final byte[] body2 = unit.getBody();

        assertSame(body1, body2);
    }
#vulnerable code 
                                @Test
    public void shouldUseSameBody() throws IOException {
        final HttpServletResponse mock = mock(HttpServletResponse.class);
        when(mock.getOutputStream()).thenReturn(new ServletOutputStream() {
            @Override
            public void write(final int b) throws IOException {
            }
        });

        final LocalResponse response = new LocalResponse(mock, "1");
        response.getOutputStream().write("test".getBytes());

        final byte[] body1 = response.getBody();
        final byte[] body2 = response.getBody();

        assertSame(body1, body2);
    } 
                            #location 7 
                            #vulnerability type RESOURCE_LEAK