channel.write(". CAPABILITY\r\n");
if (config.getPassword() != null)
channel.write(". login " + config.getUsername() + " " + config.getPassword() + "\r\n");
else if (config.getOAuthConfig() != null) {
// Use xoauth authentication.
OAuthConfig oauth = config.getOAuthConfig();
//noinspection ConstantConditions
String oauthString = new XoauthSasl(config.getUsername(),
oauth.clientId,
oauth.clientSecret)