Code example for SocketException

0
 
    protected OpenSSLSocketImplWrapper(Socket socket, String host, int port,
            boolean autoClose, SSLParameters sslParameters) throws IOException {
        super(socket, host, port, autoClose, sslParameters);
        if (!socket.isConnected()) {
            throw new SocketException("Socket is not connected.");
        } 
        this.socket = socket;
    } 
 
    @Override 
    public void connect(SocketAddress sockaddr, int timeout)
        throws IOException { 
        throw new IOException("Underlying socket is already connected.");
    } 
 
    @Override 
    public void connect(SocketAddress sockaddr) throws IOException {
        throw new IOException("Underlying socket is already connected.");
    }