当前位置: 首页>>代码示例>>Java>>正文


Java SshClient.setUpDefaultClient方法代码示例

本文整理汇总了Java中org.apache.sshd.SshClient.setUpDefaultClient方法的典型用法代码示例。如果您正苦于以下问题:Java SshClient.setUpDefaultClient方法的具体用法?Java SshClient.setUpDefaultClient怎么用?Java SshClient.setUpDefaultClient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.sshd.SshClient的用法示例。


在下文中一共展示了SshClient.setUpDefaultClient方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: KarafSshShellConnection

import org.apache.sshd.SshClient; //导入方法依赖的package包/类
/**
 * Creates a remote shell connection to a Karaf instance using the SSH
 * protocol
 *
 * @param connectionUrl
 *            the coordinates used to establish the connection
 * @param credentials
 *            the username and password used to authenticate when connection
 * @param inputStream
 *            the {@link InputStream} used to interact with the remote
 *            system
 * @param outputStream
 *            the {@link OutputStream} used to receive data from
 *            {@code stdout} of the remote system
 * @param errorStream
 *            the {@link OutputStream} used to receive data from
 *            {@code stderr} of the remote system
 */
public KarafSshShellConnection(
        final KarafSshConnectionUrl connectionUrl,
        final Credentials credentials,
        final InputStream inputStream,
        final OutputStream outputStream,
        final OutputStream errorStream)
{

    this.connectionUrl = connectionUrl;
    this.credentials = credentials;

    this.inputStream = inputStream;
    this.outputStream = outputStream;
    this.errorStream = errorStream;

    this.exception = null;

    this.sshClient = SshClient.setUpDefaultClient();
}
 
开发者ID:apache,项目名称:karaf-eik,代码行数:38,代码来源:KarafSshShellConnection.java

示例2: setUp

import org.apache.sshd.SshClient; //导入方法依赖的package包/类
@SuppressWarnings("serial")
@Before
public void setUp() throws Exception {

	app = new Application() {
		@Override
		public void init() {}
	};
	mainWindow = new Window();
	app.setMainWindow(mainWindow);

	SSHWindow sshWindow = new SSHWindow(null, 200, 200);
	app.getMainWindow().addWindow(sshWindow);

	SshClient client = SshClient.setUpDefaultClient();
	client.start();
	ClientSession session = null;
	try {
		session = client.connect(testHost, testPort).await().getSession();
	} catch (Exception e) {
		fail("Could not connect to host");
	}
	sshTerm = new SSHTerminal(sshWindow, session, 200, 200);
	sshWindow.addComponent(sshTerm);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:26,代码来源:SSHTerminalTest.java

示例3: setup

import org.apache.sshd.SshClient; //导入方法依赖的package包/类
@SuppressWarnings("serial")
@Before
   public void setup () {
       app = new Application() {
           @Override
           public void init() {}
       };
       sshWindow = new SSHWindow(null, 200, 200);
       client = SshClient.setUpDefaultClient();
       client.start();
       try {
		session = client.connect(testHost, testPort).await().getSession();
	} catch (Exception e) {
		fail("Could not connect to host");
	}
       sshWindow2 = new SSHWindow(session, 200, 200);
       mainWindow = new Window();
       app.setMainWindow(mainWindow);
       app.getMainWindow().addWindow(sshWindow);
       app.getMainWindow().addWindow(sshWindow2);
       
   }
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:23,代码来源:SSHWindowTest.java

示例4: call

import org.apache.sshd.SshClient; //导入方法依赖的package包/类
@Test(timeout = 10000L)
public void call() throws Exception {
    final SshClient client = SshClient.setUpDefaultClient();
    client.start();
    try {
        final ClientSession session = client.connect("localhost", 4222).await().getSession();
        session.authPassword("jonathan", "secret");

        final ClientChannel channel = session.createChannel("shell");
        ByteArrayOutputStream sent = new ByteArrayOutputStream();
        PipedOutputStream pipedIn = new TeePipedOutputStream(sent);
        channel.setIn(new PipedInputStream(pipedIn));
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ByteArrayOutputStream err = new ByteArrayOutputStream();
        channel.setOut(out);
        channel.setErr(err);
        channel.open();

        pipedIn.write("properties\r\n".getBytes());
        pipedIn.flush();

        pipedIn.write("exit\r\n".getBytes());
        pipedIn.flush();

        channel.waitFor(ClientChannel.CLOSED, 0);
        channel.close(false);
        client.stop();

        assertTrue(new String(sent.toByteArray()).contains("properties\r\nexit\r\n"));
        assertTrue(new String(out.toByteArray()).contains("ServerService(id=ssh)"));
    } catch (Exception e) {
        e.printStackTrace();
        fail();
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:36,代码来源:SSHServerTest.java

示例5: doStart

import org.apache.sshd.SshClient; //导入方法依赖的package包/类
@Override
protected void doStart() throws Exception {
    client = SshClient.setUpDefaultClient();
    client.start();
    
    super.doStart();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:SshProducer.java

示例6: setup

import org.apache.sshd.SshClient; //导入方法依赖的package包/类
@PostConstruct
protected void setup(){
	sshClient = SshClient.setUpDefaultClient();
	sshClient.start();
}
 
开发者ID:northlander,项目名称:activemft,代码行数:6,代码来源:SftpReceiver.java

示例7: SshConnectionFactory

import org.apache.sshd.SshClient; //导入方法依赖的package包/类
public SshConnectionFactory() {
	client = SshClient.setUpDefaultClient();
}
 
开发者ID:northshorefiend,项目名称:sshproxyj,代码行数:4,代码来源:SshConnectionFactory.java


注:本文中的org.apache.sshd.SshClient.setUpDefaultClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。