/** * Start TLS on an existing socket. * Supports the "STARTTLS" command in many protocols. * This version for compatibility with possible third party code * that might've used this API even though it shouldn't. * * @param socket the existing socket * @return the wrapped Socket * @exception IOException for I/O errors * @deprecated */ @Deprecated public static Socket startTLS(Socket socket) throws IOException { return startTLS(socket, new Properties(), "socket"); }
/** * Start TLS on an existing socket. * Supports the "STARTTLS" command in many protocols. * This version for compatibility with possible third party code * that might've used this API even though it shouldn't. * * @param socket the existing socket * @return the wrapped Socket * @exception IOException for I/O errors * @deprecated */ @Deprecated public static Socket startTLS(Socket socket) throws IOException { return startTLS(socket, new Properties(), "socket"); }
/** * Start TLS on an existing socket. * Supports the "STARTTLS" command in many protocols. * This version for compatibility with possible third party code * that might've used this API even though it shouldn't. * * @param socket the existing socket * @param props the properties * @param prefix the property prefix * @return the wrapped Socket * @exception IOException for I/O errors * @deprecated */ @Deprecated public static Socket startTLS(Socket socket, Properties props, String prefix) throws IOException { InetAddress a = socket.getInetAddress(); String host = a.getHostName(); return startTLS(socket, host, props, prefix); }
/** * Start TLS on an existing socket. * Supports the "STARTTLS" command in many protocols. * This version for compatibility with possible third party code * that might've used this API even though it shouldn't. * * @param socket the existing socket * @param props the properties * @param prefix the property prefix * @return the wrapped Socket * @exception IOException for I/O errors * @deprecated */ @Deprecated public static Socket startTLS(Socket socket, Properties props, String prefix) throws IOException { InetAddress a = socket.getInetAddress(); String host = a.getHostName(); return startTLS(socket, host, props, prefix); }
/** * Start TLS using STLS command specified by RFC 2595. * If already using SSL, this is a nop and the STLS command is not issued. */ synchronized boolean stls() throws IOException { if (socket instanceof SSLSocket) return true; // nothing to do Response r = simpleCommand("STLS"); if (r.ok) { // it worked, now switch the socket into TLS mode try { socket = SocketFetcher.startTLS(socket, host, props, prefix); initStreams(); } catch (IOException ioex) { try { socket.close(); } finally { socket = null; input = null; output = null; } IOException sioex = new IOException("Could not convert socket to TLS"); sioex.initCause(ioex); throw sioex; } } return r.ok; }
/** * Start TLS using STLS command specified by RFC 2595. * If already using SSL, this is a nop and the STLS command is not issued. */ synchronized boolean stls() throws IOException { if (socket instanceof SSLSocket) return true; // nothing to do Response r = simpleCommand("STLS"); if (r.ok) { // it worked, now switch the socket into TLS mode try { socket = SocketFetcher.startTLS(socket, host, props, prefix); initStreams(); } catch (IOException ioex) { try { socket.close(); } finally { socket = null; input = null; output = null; } IOException sioex = new IOException("Could not convert socket to TLS"); sioex.initCause(ioex); throw sioex; } } return r.ok; }
/** * Start TLS on the current connection. * <code>cmd</code> is the command to issue to start TLS negotiation. * If the command succeeds, we begin TLS negotiation. * If the socket is already an SSLSocket this is a nop and the command * is not issued. * * @param cmd the command to issue * @exception IOException for I/O errors * @exception ProtocolException for protocol failures */ public synchronized void startTLS(String cmd) throws IOException, ProtocolException { if (socket instanceof SSLSocket) return; // nothing to do simpleCommand(cmd, null); socket = SocketFetcher.startTLS(socket, host, props, prefix); initStreams(); }
/** * Start TLS on the current connection. * <code>cmd</code> is the command to issue to start TLS negotiation. * If the command succeeds, we begin TLS negotiation. * If the socket is already an SSLSocket this is a nop and the command * is not issued. * * @param cmd the command to issue * @exception IOException for I/O errors * @exception ProtocolException for protocol failures */ public synchronized void startTLS(String cmd) throws IOException, ProtocolException { if (socket instanceof SSLSocket) return; // nothing to do simpleCommand(cmd, null); socket = SocketFetcher.startTLS(socket, host, props, prefix); initStreams(); }
/** * Issue the <code>STARTTLS</code> command and switch the socket to * TLS mode if it succeeds. * * @exception MessagingException for failures * @since JavaMail 1.4.1 */ protected void startTLS() throws MessagingException { issueCommand("STARTTLS", 220); // it worked, now switch the socket into TLS mode try { serverSocket = SocketFetcher.startTLS(serverSocket, host, session.getProperties(), "mail." + name); initStreams(); } catch (IOException ioex) { closeConnection(); throw new MessagingException("Could not convert socket to TLS", ioex); } }
/** * Issue the <code>STARTTLS</code> command and switch the socket to * TLS mode if it succeeds. * * @exception MessagingException for failures * @since JavaMail 1.4.1 */ protected void startTLS() throws MessagingException { issueCommand("STARTTLS", 220); // it worked, now switch the socket into TLS mode try { serverSocket = SocketFetcher.startTLS(serverSocket, host, session.getProperties(), "mail." + name); initStreams(); } catch (IOException ioex) { closeConnection(); throw new MessagingException("Could not convert socket to TLS", ioex); } }
/** * Start TLS on an existing socket. * Supports the "STARTTLS" command in many protocols. * This version for compatibility possible third party code * that might've used this API even though it shouldn't. */ public static Socket startTLS(Socket socket) throws IOException { return startTLS(socket, new Properties(), "socket"); }
/** * Start TLS on an existing socket. * Supports the "STARTTLS" command in many protocols. * This version for compatibility with possible third party code * that might've used this API even though it shouldn't. */ public static Socket startTLS(Socket socket) throws IOException { return startTLS(socket, new Properties(), "socket"); }
/** * Start TLS on an existing socket. * Supports the "STARTTLS" command in many protocols. * This version for compatibility with possible third party code * that might've used this API even though it shouldn't. */ public static Socket startTLS(Socket socket, Properties props, String prefix) throws IOException { InetAddress a = socket.getInetAddress(); String host = a.getHostName(); return startTLS(socket, host, props, prefix); }
/** * Start TLS on an existing socket. * Supports the "STARTTLS" command in many protocols. * This version for compatibility with possible third party code * that might've used this API even though it shouldn't. * * @param socket the existing socket * @return the wrapped Socket * @exception IOException for I/O errors * @deprecated */ @Deprecated public static Socket startTLS(Socket socket) throws IOException { return startTLS(socket, new Properties(), "socket"); }
/** * Start TLS on an existing socket. * Supports the "STARTTLS" command in many protocols. * This version for compatibility with possible third party code * that might've used this API even though it shouldn't. * * @param socket the existing socket * @return the wrapped Socket * @exception IOException for I/O errors * @deprecated */ @Deprecated public static Socket startTLS(Socket socket) throws IOException { return startTLS(socket, new Properties(), "socket"); }
/** * Start TLS on an existing socket. * Supports the "STARTTLS" command in many protocols. * This version for compatibility with possible third party code * that might've used this API even though it shouldn't. * * @param socket the existing socket * @return the wrapped Socket * @exception IOException for I/O errors * @deprecated */ @Deprecated public static Socket startTLS(Socket socket) throws IOException { return startTLS(socket, new Properties(), "socket"); }
/** * Start TLS on an existing socket. * Supports the "STARTTLS" command in many protocols. * This version for compatibility with possible third party code * that might've used this API even though it shouldn't. * * @param socket the existing socket * @return the wrapped Socket * @exception IOException for I/O errors * @deprecated */ @Deprecated public static Socket startTLS(Socket socket) throws IOException { return startTLS(socket, new Properties(), "socket"); }
/** * Start TLS on an existing socket. * Supports the "STARTTLS" command in many protocols. * This version for compatibility with possible third party code * that might've used this API even though it shouldn't. * * @param socket the existing socket * @return the wrapped Socket * @exception IOException for I/O errors * @deprecated */ @Deprecated public static Socket startTLS(Socket socket) throws IOException { return startTLS(socket, new Properties(), "socket"); }
/** * Start TLS on the current connection. * <code>cmd</code> is the command to issue to start TLS negotiation. * If the command succeeds, we begin TLS negotiation. */ public synchronized void startTLS(String cmd) throws IOException, ProtocolException { simpleCommand(cmd, null); socket = SocketFetcher.startTLS(socket, host, props, prefix); initStreams(out); }
/** * Start TLS on the current connection. * <code>cmd</code> is the command to issue to start TLS negotiation. * If the command succeeds, we begin TLS negotiation. */ public synchronized void startTLS(String cmd) throws IOException, ProtocolException { simpleCommand(cmd, null); socket = SocketFetcher.startTLS(socket, props, prefix); initStreams(out); }