### Question:
GlassfishSSLImpl extends SSLImplementation { public ServerSocketFactory getServerSocketFactory() { if(Boolean.valueOf(System.getProperty(PROP_GLASSFISH_SOCKETFACTORY, "false"))) { return new GlassfishServerSocketFactory(); } else { return new JSSE14SocketFactory(); } } GlassfishSSLImpl(); String getImplementationName(); ServerSocketFactory getServerSocketFactory(); SSLSupport getSSLSupport(Socket socket); SSLSupport getSSLSupport(SSLEngine ssle); static final String PROP_GLASSFISH_SOCKETFACTORY; }### Answer:
@Test public void testGetServerSocketFactoryGF() { System.setProperty(GlassfishSSLImpl.PROP_GLASSFISH_SOCKETFACTORY, "true"); ServerSocketFactory factory = cut.getServerSocketFactory(); assertTrue(factory instanceof GlassfishServerSocketFactory); }
@Test public void testGetServerSocketFactoryJSSE14() { System.setProperty(GlassfishSSLImpl.PROP_GLASSFISH_SOCKETFACTORY, "false"); ServerSocketFactory factory = cut.getServerSocketFactory(); assertTrue(factory instanceof JSSE14SocketFactory); }
@Test public void testGetServerSocketFactoryNotSet() { System.clearProperty(GlassfishSSLImpl.PROP_GLASSFISH_SOCKETFACTORY); ServerSocketFactory factory = cut.getServerSocketFactory(); assertTrue(factory instanceof JSSE14SocketFactory); }