@Test
public void testDoConnect() throws Exception {

    HttpURLConnection mockConnection = Mockito.mock(HttpURLConnection.class);
    PolicyRestController controller = new PolicyRestController();
    Mockito.doNothing().when(mockConnection).connect();
    InputStream mockInputStream = Mockito.mock(InputStream.class);
    when(mockConnection.getResponseCode()).thenReturn(200);
    when(mockConnection.getInputStream()).thenReturn(mockInputStream);
    Whitebox.invokeMethod(controller, "doConnect", mockConnection);
    verify(mockConnection).getResponseCode();
    verify(mockConnection).getInputStream();
    when(mockConnection.getResponseCode()).thenReturn(201);
    assertNull(Whitebox.invokeMethod(controller, "doConnect", mockConnection));
}