private void _connect(InetAddress host, int port, InetAddress localAddr, int localPort) throws SocketException, IOException { _socket_ = _socketFactory_.createSocket(); if (receiveBufferSize != -1) { _socket_.setReceiveBufferSize(receiveBufferSize); } if (sendBufferSize != -1) { _socket_.setSendBufferSize(sendBufferSize); } if (localAddr != null) { _socket_.bind(new InetSocketAddress(localAddr, localPort)); } _socket_.connect(new InetSocketAddress(host, port), connectTimeout); _connectAction_(); }
/*** Initiates control connections and gets initial reply. ***/ @Override protected void _connectAction_() throws IOException { super._connectAction_(); _reader = new CRLFLineReader(new InputStreamReader(_input_, encoding)); _writer = new BufferedWriter(new OutputStreamWriter(_output_, encoding)); __getReply(); }
/*** * Initiates control connections and gets initial reply, determining * if the client is allowed to post to the server. Initializes * {@link #_reader_} and {@link #_writer_} to wrap * {@link SocketClient#_input_} and {@link SocketClient#_output_}. ***/ @Override protected void _connectAction_() throws IOException { super._connectAction_(); _reader_ = new CRLFLineReader(new InputStreamReader(_input_, __DEFAULT_ENCODING)); _writer_ = new BufferedWriter(new OutputStreamWriter(_output_, __DEFAULT_ENCODING)); __getReply(); _isAllowedToPost = (_replyCode == NNTPReply.SERVER_READY_POSTING_ALLOWED); }
/*** * Performs connection initialization and sets state to * <code> AUTHORIZATION_STATE </code>. ***/ @Override protected void _connectAction_() throws IOException { super._connectAction_(); _reader = new CRLFLineReader(new InputStreamReader(_input_, _DEFAULT_ENCODING)); _writer = new BufferedWriter(new OutputStreamWriter(_output_, _DEFAULT_ENCODING)); __getReply(); setState(AUTHORIZATION_STATE); }
/** * Performs connection initialization and sets state to * {@link IMAPState#NOT_AUTH_STATE}. */ @Override protected void _connectAction_() throws IOException { super._connectAction_(); _reader = new CRLFLineReader(new InputStreamReader(_input_, __DEFAULT_ENCODING)); __writer = new BufferedWriter(new OutputStreamWriter(_output_, __DEFAULT_ENCODING)); int tmo = getSoTimeout(); if (tmo <= 0) { // none set currently setSoTimeout(connectTimeout); // use connect timeout to ensure we don't block forever } __getReply(false); // untagged response if (tmo <= 0) { setSoTimeout(tmo); // restore the original value } setState(IMAPState.NOT_AUTH_STATE); }
super._connectAction_(); // sets up _input_ and _output_ if(socketIsReader == null) { _controlInput_ =
super._connectAction_(); _input_ = new BufferedInputStream(_input_); _output_ = new BufferedOutputStream(_output_);
/*** Initiates control connections and gets initial reply. ***/ protected void _connectAction_() throws IOException { super._connectAction_(); _reader = new BufferedReader(new InputStreamReader(_input_, __DEFAULT_ENCODING)); _writer = new BufferedWriter(new OutputStreamWriter(_output_, __DEFAULT_ENCODING)); __getReply(); }
/** * Opens a Socket connected to a remote host at the specified port and * originating from the current host at a system assigned port. * Before returning, {@link #_connectAction_ _connectAction_() } * is called to perform connection initialization actions. * <p> * @param host The remote host. * @param port The port to connect to on the remote host. * @exception SocketException If the socket timeout could not be set. * @exception IOException If the socket could not be opened. In most * cases you will only want to catch IOException since SocketException is * derived from it. */ public void connect(InetAddress host, int port) throws SocketException, IOException { _socket_ = _socketFactory_.createSocket(); _socket_.connect(new InetSocketAddress(host, port), connectTimeout); _connectAction_(); }
/** * Opens a Socket connected to a remote host at the specified port and * originating from the current host at a system assigned port. * Before returning, {@link #_connectAction_ _connectAction_() } * is called to perform connection initialization actions. * <p> * @param hostname The name of the remote host. * @param port The port to connect to on the remote host. * @exception SocketException If the socket timeout could not be set. * @exception IOException If the socket could not be opened. In most * cases you will only want to catch IOException since SocketException is * derived from it. * @exception UnknownHostException If the hostname cannot be resolved. */ public void connect(String hostname, int port) throws SocketException, IOException { _socket_= _socketFactory_.createSocket(); _socket_.connect(new InetSocketAddress(hostname, port), connectTimeout); _connectAction_(); }
/*** Initiates control connections and gets initial reply. ***/ @Override protected void _connectAction_() throws IOException { super._connectAction_(); _reader = new BufferedReader(new InputStreamReader(_input_, encoding)); _writer = new BufferedWriter(new OutputStreamWriter(_output_, encoding)); __getReply(); }
/** * Opens a Socket connected to a remote host at the specified port and * originating from the specified local address and port. * Before returning, {@link #_connectAction_ _connectAction_() } * is called to perform connection initialization actions. * <p> * @param host The remote host. * @param port The port to connect to on the remote host. * @param localAddr The local address to use. * @param localPort The local port to use. * @exception SocketException If the socket timeout could not be set. * @exception IOException If the socket could not be opened. In most * cases you will only want to catch IOException since SocketException is * derived from it. */ public void connect(InetAddress host, int port, InetAddress localAddr, int localPort) throws SocketException, IOException { _socket_ = _socketFactory_.createSocket(); _socket_.bind(new InetSocketAddress(localAddr, localPort)); _socket_.connect(new InetSocketAddress(host, port), connectTimeout); _connectAction_(); }
/** * Opens a Socket connected to a remote host at the specified port and * originating from the current host at a system assigned port. * Before returning, {@link #_connectAction_ _connectAction_() } * is called to perform connection initialization actions. * <p> * @param host The remote host. * @param port The port to connect to on the remote host. * @exception SocketException If the socket timeout could not be set. * @exception IOException If the socket could not be opened. In most * cases you will only want to catch IOException since SocketException is * derived from it. */ public void connect(InetAddress host, int port) throws SocketException, IOException { _socket_ = _socketFactory_.createSocket(host, port); _connectAction_(); }
/*** * Initiates control connections and gets initial reply, determining * if the client is allowed to post to the server. Initializes * {@link #_reader_} and {@link #_writer_} to wrap * {@link SocketClient#_input_} and {@link SocketClient#_output_}. ***/ protected void _connectAction_() throws IOException { super._connectAction_(); _reader_ = new BufferedReader(new InputStreamReader(_input_, __DEFAULT_ENCODING)); _writer_ = new BufferedWriter(new OutputStreamWriter(_output_, __DEFAULT_ENCODING)); __getReply(); _isAllowedToPost = (_replyCode == NNTPReply.SERVER_READY_POSTING_ALLOWED); }
/*** * Initiates control connections and gets initial reply, determining * if the client is allowed to post to the server. Initializes * {@link #_reader_} and {@link #_writer_} to wrap * {@link SocketClient#_input_} and {@link SocketClient#_output_}. ***/ @Override protected void _connectAction_() throws IOException { super._connectAction_(); _reader_ = new BufferedReader(new InputStreamReader(_input_, __DEFAULT_ENCODING)); _writer_ = new BufferedWriter(new OutputStreamWriter(_output_, __DEFAULT_ENCODING)); __getReply(); _isAllowedToPost = (_replyCode == NNTPReply.SERVER_READY_POSTING_ALLOWED); }
/** * Opens a Socket connected to a remote host at the specified port and * originating from the current host at a system assigned port. * Before returning, {@link #_connectAction_ _connectAction_() } * is called to perform connection initialization actions. * <p> * @param hostname The name of the remote host. * @param port The port to connect to on the remote host. * @exception SocketException If the socket timeout could not be set. * @exception IOException If the socket could not be opened. In most * cases you will only want to catch IOException since SocketException is * derived from it. * @exception UnknownHostException If the hostname cannot be resolved. */ public void connect(String hostname, int port) throws SocketException, IOException { _socket_ = _socketFactory_.createSocket(hostname, port); _connectAction_(); }
/*** * Performs connection initialization and sets state to * <code> AUTHORIZATION_STATE </code>. ***/ protected void _connectAction_() throws IOException { super._connectAction_(); _reader = new BufferedReader(new InputStreamReader(_input_, __DEFAULT_ENCODING)); __writer = new BufferedWriter(new OutputStreamWriter(_output_, __DEFAULT_ENCODING)); __getReply(); setState(AUTHORIZATION_STATE); }
/** * Opens a Socket connected to a remote host at the specified port and * originating from the specified local address and port. * Before returning, {@link #_connectAction_ _connectAction_() } * is called to perform connection initialization actions. * <p> * @param host The remote host. * @param port The port to connect to on the remote host. * @param localAddr The local address to use. * @param localPort The local port to use. * @exception SocketException If the socket timeout could not be set. * @exception IOException If the socket could not be opened. In most * cases you will only want to catch IOException since SocketException is * derived from it. */ public void connect(InetAddress host, int port, InetAddress localAddr, int localPort) throws SocketException, IOException { _socket_ = _socketFactory_.createSocket(host, port, localAddr, localPort); _connectAction_(); }
/*** * Performs connection initialization and sets state to * <code> AUTHORIZATION_STATE </code>. ***/ @Override protected void _connectAction_() throws IOException { super._connectAction_(); _reader = new BufferedReader(new InputStreamReader(_input_, __DEFAULT_ENCODING)); __writer = new BufferedWriter(new OutputStreamWriter(_output_, __DEFAULT_ENCODING)); __getReply(); setState(AUTHORIZATION_STATE); }
/** * Initiates control connections and gets initial reply. * Initializes {@link #_controlInput_} and {@link #_controlOutput_}. */ @Override protected void _connectAction_() throws IOException { super._connectAction_(); _controlInput_ = new BufferedReader(new InputStreamReader(_socket_.getInputStream(), getControlEncoding())); _controlOutput_ = new BufferedWriter(new OutputStreamWriter(_socket_.getOutputStream(), getControlEncoding())); __getReply(); // If we received code 120, we have to fetch completion reply. if (FTPReply.isPositivePreliminary(_replyCode)) __getReply(); }