MCPcopy Create free account
hub / github.com/M66B/FairEmail / Protocol

Method Protocol

app/src/main/java/com/sun/mail/pop3/Protocol.java:81–143  ·  view source on GitHub ↗

Open a connection to the POP3 server.

(String host, int port, MailLogger logger,
			Properties props, String prefix, boolean isSSL)

Source from the content-addressed store, hash-verified

79 * Open a connection to the POP3 server.
80 */
81 Protocol(String host, int port, MailLogger logger,
82 Properties props, String prefix, boolean isSSL)
83 throws IOException {
84 this.host = host;
85 this.props = props;
86 this.prefix = prefix;
87 this.logger = logger;
88 traceLogger = logger.getSubLogger("protocol", null);
89 noauthdebug = !PropUtil.getBooleanProperty(props,
90 "mail.debug.auth", false);
91
92 Response r;
93 boolean enableAPOP = getBoolProp(props, prefix + ".apop.enable");
94 boolean disableCapa = getBoolProp(props, prefix + ".disablecapa");
95 try {
96 if (port == -1)
97 port = POP3_PORT;
98 if (logger.isLoggable(Level.FINE))
99 logger.fine("connecting to host \"" + host +
100 "\", port " + port + ", isSSL " + isSSL);
101
102 socket = SocketFetcher.getSocket(host, port, props, prefix, isSSL);
103 initStreams();
104 r = simpleCommand(null);
105 } catch (IOException ioe) {
106 throw cleanupAndThrow(socket, ioe);
107 }
108
109 if (!r.ok) {
110 throw cleanupAndThrow(socket, new IOException("Connect failed"));
111 }
112 if (enableAPOP && r.data != null) {
113 int challStart = r.data.indexOf('<'); // start of challenge
114 int challEnd = r.data.indexOf('>', challStart); // end of challenge
115 if (challStart != -1 && challEnd != -1)
116 apopChallenge = r.data.substring(challStart, challEnd + 1);
117 logger.log(Level.FINE, "APOP challenge: {0}", apopChallenge);
118 }
119
120 // if server supports RFC 2449, set capabilities
121 if (!disableCapa)
122 setCapabilities(capa());
123
124 pipelining = hasCapability("PIPELINING") ||
125 PropUtil.getBooleanProperty(props, prefix + ".pipelining", false);
126 if (pipelining)
127 logger.config("PIPELINING enabled");
128
129 // created here, because they're inner classes that reference "this"
130 Authenticator[] a = new Authenticator[] {
131 new LoginAuthenticator(),
132 new PlainAuthenticator(),
133 //new DigestMD5Authenticator(),
134 new NtlmAuthenticator(),
135 new OAuth2Authenticator()
136 };
137 StringBuilder sb = new StringBuilder();
138 for (int i = 0; i < a.length; i++) {

Callers

nothing calls this directly

Calls 15

getBooleanPropertyMethod · 0.95
getBoolPropMethod · 0.95
getSocketMethod · 0.95
initStreamsMethod · 0.95
simpleCommandMethod · 0.95
cleanupAndThrowMethod · 0.95
setCapabilitiesMethod · 0.95
capaMethod · 0.95
hasCapabilityMethod · 0.95
getSubLoggerMethod · 0.80
fineMethod · 0.80
indexOfMethod · 0.80

Tested by

no test coverage detected