當前位置: 首頁>>代碼示例>>Java>>正文


Java CRLFTerminatedReader類代碼示例

本文整理匯總了Java中org.subethamail.smtp.io.CRLFTerminatedReader的典型用法代碼示例。如果您正苦於以下問題:Java CRLFTerminatedReader類的具體用法?Java CRLFTerminatedReader怎麽用?Java CRLFTerminatedReader使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CRLFTerminatedReader類屬於org.subethamail.smtp.io包,在下文中一共展示了CRLFTerminatedReader類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setSocket

import org.subethamail.smtp.io.CRLFTerminatedReader; //導入依賴的package包/類
/**
 * Initializes our reader, writer, and the i/o filter chains based on
 * the specified socket.  This is called internally when we startup
 * and when (if) SSL is started.
 */
public void setSocket(Socket socket) throws IOException
{
	this.socket = socket;
	this.input = this.socket.getInputStream();
	this.reader = new CRLFTerminatedReader(this.input);
	this.writer = new PrintWriter(this.socket.getOutputStream());

	this.socket.setSoTimeout(this.server.getConnectionTimeout());
}
 
開發者ID:voodoodyne,項目名稱:subethasmtp,代碼行數:15,代碼來源:Session.java

示例2: setSocket

import org.subethamail.smtp.io.CRLFTerminatedReader; //導入依賴的package包/類
/**
 * Initializes our reader, writer, and the i/o filter chains based on the
 * specified socket. This is called internally when we startup and when (if)
 * SSL is started.
 */
public void setSocket(Socket socket) throws IOException {
    this.socket = socket;
    this.input = this.socket.getInputStream();
    this.reader = new CRLFTerminatedReader(this.input);
    this.writer =
            new OutputStreamWriter(this.socket.getOutputStream(),
                    "US-ASCII");

    this.socket.setSoTimeout(TEN_MINUTES);
}
 
開發者ID:hontvari,項目名稱:mireka,代碼行數:16,代碼來源:SessionThread.java

示例3: getReader

import org.subethamail.smtp.io.CRLFTerminatedReader; //導入依賴的package包/類
/**
 * @return the cooked CRLF-terminated reader from the client
 */
public CRLFTerminatedReader getReader()
{
	return this.reader;
}
 
開發者ID:voodoodyne,項目名稱:subethasmtp,代碼行數:8,代碼來源:Session.java

示例4: execute

import org.subethamail.smtp.io.CRLFTerminatedReader; //導入依賴的package包/類
/** */
@Override
public void execute(String commandString, Session sess)
		throws IOException
{
	if (sess.isAuthenticated())
	{
		sess.sendResponse("503 Refusing any other AUTH command.");
		return;
	}

	AuthenticationHandlerFactory authFactory = sess.getServer().getAuthenticationHandlerFactory();

	if (authFactory == null)
	{
		sess.sendResponse("502 Authentication not supported");
		return;
	}

	AuthenticationHandler authHandler = authFactory.create();

	String[] args = this.getArgs(commandString);
	// Let's check the command syntax
	if (args.length < 2)
	{
		sess.sendResponse("501 Syntax: " + VERB + " mechanism [initial-response]");
		return;
	}

	// Let's check if we support the required authentication mechanism
	String mechanism = args[1];
	if (!authFactory.getAuthenticationMechanisms().contains(mechanism.toUpperCase(Locale.ENGLISH)))
	{
		sess.sendResponse("504 The requested authentication mechanism is not supported");
		return;
	}
	// OK, let's go trough the authentication process.
	try
	{
		// The authentication process may require a series of challenge-responses
		CRLFTerminatedReader reader = sess.getReader();

		String response = authHandler.auth(commandString);
		if (response != null)
		{
			// challenge-response iteration
			sess.sendResponse(response);
		}

		while (response != null)
		{
			String clientInput = reader.readLine();
			if (clientInput.trim().equals(AUTH_CANCEL_COMMAND))
			{
				// RFC 2554 explicitly states this:
				sess.sendResponse("501 Authentication canceled by client.");
				return;
			}
			else
			{
				response = authHandler.auth(clientInput);
				if (response != null)
				{
					// challenge-response iteration
					sess.sendResponse(response);
				}
			}
		}

		sess.sendResponse("235 Authentication successful.");
		sess.setAuthenticationHandler(authHandler);
	}
	catch (RejectException authFailed)
	{
		sess.sendResponse(authFailed.getErrorResponse());
	}
}
 
開發者ID:voodoodyne,項目名稱:subethasmtp,代碼行數:78,代碼來源:AuthCommand.java


注:本文中的org.subethamail.smtp.io.CRLFTerminatedReader類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。