public void testInitialState() {
assertNotNull(protocolManager.getConfig());
}
public void testProtocolFactoryMapping() throws URISyntaxException {
Protocol protocol = protocolManager.getProtocolBySite(new URI("ftp://localhost"), new NoAuthentication(), null);
assertNotNull(protocol);
assertTrue(protocol instanceof MockProtocol);
MockProtocol mockProtocol = (MockProtocol) protocol;
assertEquals("ftp1", mockProtocol.getFactoryId());
//test that ftp1 was memorized and is returned again even though a Verifier was supplied this time that would return ftp3
protocol = protocolManager.getProtocolBySite(new URI("ftp://localhost"), new NoAuthentication(), new ProtocolVerifier() {
public boolean verify(Protocol protocol, URI site,
Authentication auth) {
if (protocol instanceof MockProtocol) {
MockProtocol mockProtocol = (MockProtocol) protocol;
return mockProtocol.getFactoryId().equals("ftp3");