### Question:
Pop3Connection { InputStream getInputStream() { return in; } Pop3Connection(Pop3Settings settings,
            TrustedSocketFactory trustedSocketFactory);   }### Answer:
@Test public void withTLS_connectsToSocket() throws Exception { String response = INITIAL_RESPONSE + AUTH_HANDLE_RESPONSE + CAPA_RESPONSE + AUTH_PLAIN_AUTHENTICATED_RESPONSE; when(mockSocket.getInputStream()).thenReturn(new ByteArrayInputStream(response.getBytes())); setSettingsForMockSocket(); settings.setAuthType(AuthType.PLAIN); new Pop3Connection(settings, mockTrustedSocketFactory); assertEquals(AUTH + CAPA + AUTH_PLAIN_WITH_LOGIN, new String(outputStream.toByteArray())); }