Package ch.ethz.ssh2

Examples of ch.ethz.ssh2.Connection


    }

    @Test
    public void testWithGanymede() throws Exception {
        // begin client config
        final Connection conn = new Connection("localhost", port);
        conn.connect(null, 5000, 0);
        conn.authenticateWithPassword("sshd", "sshd");
        final SCPClient scp_client = new SCPClient(conn);
        final Properties props = new Properties();
        props.setProperty("test", "test-passed");
        File f = new File("target/scp/gan");
        Utils.deleteRecursive(f);
        f.mkdirs();
        assertTrue(f.exists());

        String name = "test.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        name = "test2.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        assertTrue(f.delete());
        conn.close();
    }
View Full Code Here


    }

    @Test
    public void testWithGanymede() throws Exception {
        // begin client config
        final Connection conn = new Connection("localhost", port);
        conn.connect(null, 5000, 0);
        conn.authenticateWithPassword("sshd", "sshd");
        final SCPClient scp_client = new SCPClient(conn);
        final Properties props = new Properties();
        props.setProperty("test", "test-passed");
        File f = new File("target/scp/gan");
        Utils.deleteRecursive(f);
        f.mkdirs();
        assertTrue(f.exists());

        String name = "test.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        name = "test2.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        assertTrue(f.delete());
        conn.close();
    }
View Full Code Here

    /** {@inheritDoc} */
    public void open()
        throws AuthenticationException, CommandAbortedException
    {
        connection = new Connection( host, port );

        /* TODO: add proxy support
        ProxyData proxy = new HTTPProxyData( proxyHost, proxyPort, proxyUserName, proxyPassword );

        connection.setProxyData( proxy );
View Full Code Here

    }

    @Test
    public void testWithGanymede() throws Exception {
        // begin client config
        final Connection conn = new Connection("localhost", port);
        conn.connect(null, 5000, 0);
        conn.authenticateWithPassword("sshd", "sshd");
        final SCPClient scp_client = new SCPClient(conn);
        final Properties props = new Properties();
        props.setProperty("test", "test-passed");
        File f = new File("target/scp/gan");
        scp_client.put(toBytes(props, ""), "test.properties", "target/scp/gan");
        assertTrue(f.exists());
        scp_client.put(toBytes(props, ""), "test2.properties", "target/scp/gan");
        assertTrue(f.exists());
        f.delete();
        conn.close();
    }
View Full Code Here

    this.username = ini.getProperty("sshuser");
    this.password = ini.getProperty("sshpass");

    try {
      /* Create a connection instance */
      conn = new Connection(hostname);

      /* Now connect */
      conn.connect();
      boolean isAuthenticated = conn.authenticateWithPassword(username,
          password);
View Full Code Here

    this.username = username;
    this.password = password;
    try {
      /* Create a connection instance */

      conn = new Connection(hostname);

      /* Now connect */

      conn.connect();

 
View Full Code Here

    }

    @Test
    public void testWithGanymede() throws Exception {
        // begin client config
        final Connection conn = new Connection("localhost", port);
        conn.connect(null, 5000, 0);
        conn.authenticateWithPassword("sshd", "sshd");
        final SCPClient scp_client = new SCPClient(conn);
        final Properties props = new Properties();
        props.setProperty("test", "test-passed");
        scp_client.put(toBytes(props, ""), "test.properties", "target/scp/gan");
        scp_client.put(toBytes(props, ""), "test2.properties", "target/scp/gan");
View Full Code Here

    /** {@inheritDoc} */
    public void open()
        throws AuthenticationException, CommandAbortedException
    {
        connection = new Connection( host, port );

        /* TODO: add proxy support
        ProxyData proxy = new HTTPProxyData( proxyHost, proxyPort, proxyUserName, proxyPassword );

        connection.setProxyData( proxy );
View Full Code Here

    }

    @Test
    public void testWithGanymede() throws Exception {
        // begin client config
        final Connection conn = new Connection("localhost", port);
        conn.connect(null, 5000, 0);
        conn.authenticateWithPassword("sshd", "sshd");
        final SCPClient scp_client = new SCPClient(conn);
        final Properties props = new Properties();
        props.setProperty("test", "test-passed");
        File f = new File("target/scp/gan");
        Utils.deleteRecursive(f);
        f.mkdirs();
        assertTrue(f.exists());

        String name = "test.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        name = "test2.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        assertTrue(f.delete());
        conn.close();
    }
View Full Code Here

   */
  private void connect() throws IOException
  {
    logger.debug("trying to connect to " + this.username + "@" + this.hostname + ":" + this.port);
    /* Create a connection instance */
    conn = new Connection(this.hostname, this.port);

    /* Now connect */
    conn.connect();

    /* Authenticate */
 
View Full Code Here

TOP

Related Classes of ch.ethz.ssh2.Connection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.