/*
 * @(#)SshConnectedEvent.java
 *
 * Copyright (c) 2001-2002 JScape
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JScape. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JScape.
 */
package com.jscape.inet.ssh;

/**
 * Fired by Ssh instance upon successfull connection to SSH server.
 *
 * @author vglass
 */
public class SshConnectedEvent
        extends SshEvent {

    private String host;
    private int port;

    /**
     * Creates SshConnectedEvent.
     *
     * @param source the source of the event
     * @param host   the host of SSH server
     * @param port   the port of SSH server
     */
    public SshConnectedEvent(Ssh source, String host, int port) {
        super(source);

        this.host = host;
        this.port = port;
    }

    /**
     * Gets host of SSH server.
     *
     * @return host
     */
    public String getHost() {
        return this.host;
    }

    /**
     * Gets port of SSH server.
     *
     * @return port
     */
    public int getPort() {
        return this.port;
    }

    @Override
    public void accept(SshListener listener) {
        listener.connected(this);
    }

    /**
     * @return string representation
     */
    public String toString() {
        return "connected, host: " + this.host + ", port: " + this.port;
    }

}
