mirror of
https://github.com/revanced/jadb.git
synced 2025-02-14 11:06:48 +01:00
minor changes to some API
This commit is contained in:
parent
958e9258d3
commit
d1af94d257
@ -12,11 +12,11 @@ public class JadbConnection implements ITransportFactory {
|
|||||||
|
|
||||||
private static final int DEFAULTPORT = 5037;
|
private static final int DEFAULTPORT = 5037;
|
||||||
|
|
||||||
public JadbConnection() throws IOException {
|
public JadbConnection() {
|
||||||
this("localhost", DEFAULTPORT);
|
this("localhost", DEFAULTPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JadbConnection(String host, int port) throws IOException {
|
public JadbConnection(String host, int port) {
|
||||||
this.host = host;
|
this.host = host;
|
||||||
this.port = port;
|
this.port = port;
|
||||||
}
|
}
|
||||||
@ -25,16 +25,17 @@ public class JadbConnection implements ITransportFactory {
|
|||||||
return new Transport(new Socket(host, port));
|
return new Transport(new Socket(host, port));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getHostVersion() throws IOException, JadbException {
|
public String getHostVersion() throws IOException, JadbException {
|
||||||
Transport main = createTransport();
|
Transport main = createTransport();
|
||||||
main.send("host:version");
|
main.send("host:version");
|
||||||
main.verifyResponse();
|
main.verifyResponse();
|
||||||
|
String version = main.readString();
|
||||||
main.close();
|
main.close();
|
||||||
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<JadbDevice> getDevices() throws IOException, JadbException {
|
public List<JadbDevice> getDevices() throws IOException, JadbException {
|
||||||
Transport devices = createTransport();
|
Transport devices = createTransport();
|
||||||
|
|
||||||
devices.send("host:devices");
|
devices.send("host:devices");
|
||||||
devices.verifyResponse();
|
devices.verifyResponse();
|
||||||
String body = devices.readString();
|
String body = devices.readString();
|
||||||
|
@ -36,6 +36,11 @@ public class MockedTestCases {
|
|||||||
server.verifyExpectations();
|
server.verifyExpectations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetHostVersion() throws Exception {
|
||||||
|
Assert.assertEquals("001f", connection.getHostVersion());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListDevices() throws Exception {
|
public void testListDevices() throws Exception {
|
||||||
server.add("serial-123");
|
server.add("serial-123");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user