?????????Linux?????????С????
???????????? ???????[ 2014/7/18 14:26:40 ] ????????linux ??????
????3 LinuxConnection
package com.sunfan.monitor.platform.linux;
import java.io.Closeable;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sunfan.monitor.platform.IConnectable;
import com.trilead.ssh2.Connection;
import com.trilead.ssh2.ConnectionInfo;
/**
*
* @author sunfan
*
*/
public class LinuxConnection implements IConnectable?? Closeable {
Logger log = LoggerFactory.getLogger(LinuxConnection.class);
private String url?? user?? password;
private Connection connection;
/**
* init server's connect
*
* @param url
* @param user
* @param password
* @throws IOException
*/
public LinuxConnection(String url?? String user?? String password) throws IOException{
this.url = url;
this.user = user;
this.password = password;
this.connection = createConnection();
}
/**
* this method will establish connection unless username or password
* incorrect and remote server is not find
*
* @return connection
* @throws IOException
*/
private Connection createConnection() throws IOException {
connection = new Connection(url);
ConnectionInfo info = connection.connect(); // establish connection
if (false == connection.authenticateWithPassword(user?? password)){
log.error("connect server failed??please check the username and password. " + this.user + " " + this.password);
throw new IllegalArgumentException("connection remote server fail");
}
return connection;
}
/**
* close connection
*/
@Override
public void close() throws IOException {
if (connection != null)
this.connection.close();
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Connection getConnection() {
return connection;
}
public void setConnection(Connection connection) {
this.connection = connection;
}
}
|
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Linux??????DDR????????????Linux?????????????????豸??????????linux???в???????????м??????????????????????????Linux????Linux??DNS????????????γ???????????Linux?????????????Linux????(???)????????Linux ????????????????????????????????Windows???У?Linux???????Linux????????????????Linux iommu??vfio???????Linux????ε???TCP???????Linux?????????????СLinux?·???????????Linux???Jexus?й?Asp.Net Core??ó???Linux?????????Щ??
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????