jadb/src/se/vidstige/jadb/HostConnectToRemoteTcpDevice.java

30 lines
1015 B
Java
Raw Normal View History

2017-03-17 17:48:13 +01:00
package se.vidstige.jadb;
import java.io.IOException;
2017-03-20 13:17:38 +01:00
import java.net.InetSocketAddress;
2017-03-17 17:48:13 +01:00
class HostConnectToRemoteTcpDevice extends HostConnectionCommand {
2017-03-20 11:48:24 +01:00
HostConnectToRemoteTcpDevice(Transport transport) {
super(transport, new ResponseValidatorImp());
}
//Visible for testing
HostConnectToRemoteTcpDevice(Transport transport, ResponseValidator responseValidator) {
super(transport, responseValidator);
2017-03-17 17:48:13 +01:00
}
2017-03-20 13:17:38 +01:00
InetSocketAddress connect(InetSocketAddress inetSocketAddress)
2017-03-17 17:48:13 +01:00
throws IOException, JadbException, ConnectionToRemoteDeviceException {
return executeHostCommand("connect", inetSocketAddress);
2017-03-17 17:48:13 +01:00
}
static final class ResponseValidatorImp extends ResponseValidatorBase {
private static final String SUCCESSFULLY_CONNECTED = "connected to";
private static final String ALREADY_CONNECTED = "already connected to";
2017-03-17 17:48:13 +01:00
2017-03-20 11:48:24 +01:00
ResponseValidatorImp() {
super(SUCCESSFULLY_CONNECTED, ALREADY_CONNECTED);
2017-03-17 17:48:13 +01:00
}
}
}