From 7b99c48cb7f1d60538a9e23abc5213c950c2e48b Mon Sep 17 00:00:00 2001 From: Daniel Llewellyn Date: Mon, 31 Dec 2018 09:52:11 +0000 Subject: [PATCH 1/6] Adding the ability to enable tcpip from the library as per https://github.com/aosp-mirror/platform_system_core/blob/master/adb/daemon/services.cpp --- src/se/vidstige/jadb/JadbDevice.java | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/se/vidstige/jadb/JadbDevice.java b/src/se/vidstige/jadb/JadbDevice.java index 602fbbd..8f93643 100644 --- a/src/se/vidstige/jadb/JadbDevice.java +++ b/src/se/vidstige/jadb/JadbDevice.java @@ -20,6 +20,7 @@ public class JadbDevice { private static final int DEFAULT_MODE = 0664; private final String serial; private final ITransportFactory transportFactory; + private static final int DEFAULT_TCPIP_PORT = 5555; JadbDevice(String serial, ITransportFactory tFactory) { this.serial = serial; @@ -139,6 +140,31 @@ public class JadbDevice { return shellLine; } + /** + * Enable tcpip on the default port (5555) + * + * @return success or failure + */ + public boolean enableTcpip() throws IOException, JadbException { + Transport transport = getTransport(); + + send(transport, String.format("tcpip: %d", DEFAULT_TCPIP_PORT)); + return transport.readString().trim().equals(String.format("restarting in TCP Mode: %d", DEFAULT_TCPIP_PORT)); + } + + /** + * Enable tcpip on a specific port + * + * @param port for the device to bind on + * + * @return success or failure + */ + public boolean enableTcpip(int port) throws IOException, JadbException { + Transport transport = getTransport(); + send(transport, String.format("tcpip: %d", port)); + return transport.readString().trim().equals(String.format("restarting in TCP Mode: %d", port)); + } + public List list(String remotePath) throws IOException, JadbException { try (Transport transport = getTransport()) { SyncTransport sync = transport.startSync(); From 6466ee461ef5f3f0a8c384a3c72c58ad68c3636c Mon Sep 17 00:00:00 2001 From: llewellynd Date: Mon, 31 Dec 2018 10:58:07 +0000 Subject: [PATCH 2/6] Adding the ability to enable tcpip from the library as per https://github.com/aosp-mirror/platform_system_core/blob/master/adb/daemon/services.cpp --- src/se/vidstige/jadb/JadbDevice.java | 15 ++++++++------- src/se/vidstige/jadb/Util.java | 28 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 src/se/vidstige/jadb/Util.java diff --git a/src/se/vidstige/jadb/JadbDevice.java b/src/se/vidstige/jadb/JadbDevice.java index 8f93643..3c09e8b 100644 --- a/src/se/vidstige/jadb/JadbDevice.java +++ b/src/se/vidstige/jadb/JadbDevice.java @@ -1,11 +1,13 @@ package se.vidstige.jadb; import se.vidstige.jadb.managers.Bash; - import java.io.*; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; +import static se.vidstige.jadb.Util.inputStreamToString; + public class JadbDevice { @SuppressWarnings("squid:S00115") public enum State { @@ -146,10 +148,7 @@ public class JadbDevice { * @return success or failure */ public boolean enableTcpip() throws IOException, JadbException { - Transport transport = getTransport(); - - send(transport, String.format("tcpip: %d", DEFAULT_TCPIP_PORT)); - return transport.readString().trim().equals(String.format("restarting in TCP Mode: %d", DEFAULT_TCPIP_PORT)); + return enableTcpip(DEFAULT_TCPIP_PORT); } /** @@ -161,8 +160,10 @@ public class JadbDevice { */ public boolean enableTcpip(int port) throws IOException, JadbException { Transport transport = getTransport(); - send(transport, String.format("tcpip: %d", port)); - return transport.readString().trim().equals(String.format("restarting in TCP Mode: %d", port)); + send(transport, String.format("tcpip:%d", port)); + String expectedResult = String.format("restarting in TCP Mode: %d", port); + + return inputStreamToString(transport.getInputStream()).equals(expectedResult); } public List list(String remotePath) throws IOException, JadbException { diff --git a/src/se/vidstige/jadb/Util.java b/src/se/vidstige/jadb/Util.java new file mode 100644 index 0000000..0dcf202 --- /dev/null +++ b/src/se/vidstige/jadb/Util.java @@ -0,0 +1,28 @@ +package se.vidstige.jadb; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; + +public class Util { + /** + * Convert an input stream to string + * + * @param inputStream input stream + * + * @return string representation of the input stream + * + * @throws IOException if an error ocurrs reading the input stream + */ + public static String inputStreamToString(InputStream inputStream) throws IOException { + ByteArrayOutputStream result = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int length; + while ((length = inputStream.read(buffer)) != -1) { + result.write(buffer, 0, length); + } + + return result.toString(StandardCharsets.UTF_8.name()); + } +} From 01b5022d65a1d006398d824a96174971981480e6 Mon Sep 17 00:00:00 2001 From: Daniel Llewellyn Date: Sun, 6 Jan 2019 12:18:38 +0000 Subject: [PATCH 3/6] Adding the ability to enable tcpip from the jadb Using the information from https://github.com/aosp-mirror/platform_system_core/blob/master/adb/daemon/services.cpp for the spec on how to construct the response. Usage is simply ```JadbDevice jadbDevice = ...; jadbDevice.enableTcpip()``` --- src/se/vidstige/jadb/JadbDevice.java | 29 +++++++++++++++++++++++++++- src/se/vidstige/jadb/Util.java | 28 +++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/se/vidstige/jadb/Util.java diff --git a/src/se/vidstige/jadb/JadbDevice.java b/src/se/vidstige/jadb/JadbDevice.java index 602fbbd..3c09e8b 100644 --- a/src/se/vidstige/jadb/JadbDevice.java +++ b/src/se/vidstige/jadb/JadbDevice.java @@ -1,11 +1,13 @@ package se.vidstige.jadb; import se.vidstige.jadb.managers.Bash; - import java.io.*; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; +import static se.vidstige.jadb.Util.inputStreamToString; + public class JadbDevice { @SuppressWarnings("squid:S00115") public enum State { @@ -20,6 +22,7 @@ public class JadbDevice { private static final int DEFAULT_MODE = 0664; private final String serial; private final ITransportFactory transportFactory; + private static final int DEFAULT_TCPIP_PORT = 5555; JadbDevice(String serial, ITransportFactory tFactory) { this.serial = serial; @@ -139,6 +142,30 @@ public class JadbDevice { return shellLine; } + /** + * Enable tcpip on the default port (5555) + * + * @return success or failure + */ + public boolean enableTcpip() throws IOException, JadbException { + return enableTcpip(DEFAULT_TCPIP_PORT); + } + + /** + * Enable tcpip on a specific port + * + * @param port for the device to bind on + * + * @return success or failure + */ + public boolean enableTcpip(int port) throws IOException, JadbException { + Transport transport = getTransport(); + send(transport, String.format("tcpip:%d", port)); + String expectedResult = String.format("restarting in TCP Mode: %d", port); + + return inputStreamToString(transport.getInputStream()).equals(expectedResult); + } + public List list(String remotePath) throws IOException, JadbException { try (Transport transport = getTransport()) { SyncTransport sync = transport.startSync(); diff --git a/src/se/vidstige/jadb/Util.java b/src/se/vidstige/jadb/Util.java new file mode 100644 index 0000000..0dcf202 --- /dev/null +++ b/src/se/vidstige/jadb/Util.java @@ -0,0 +1,28 @@ +package se.vidstige.jadb; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; + +public class Util { + /** + * Convert an input stream to string + * + * @param inputStream input stream + * + * @return string representation of the input stream + * + * @throws IOException if an error ocurrs reading the input stream + */ + public static String inputStreamToString(InputStream inputStream) throws IOException { + ByteArrayOutputStream result = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int length; + while ((length = inputStream.read(buffer)) != -1) { + result.write(buffer, 0, length); + } + + return result.toString(StandardCharsets.UTF_8.name()); + } +} From 4dd168bb16478ea34cc0b00f47e943ec677dfd9d Mon Sep 17 00:00:00 2001 From: Daniel Llewellyn Date: Sun, 6 Jan 2019 19:09:15 +0000 Subject: [PATCH 4/6] Code review changes Adding the following changes: * Adding a unit test * Removing a readToStringFunction * Adding handler into AdbProtocolHandler to enable testing * --- src/se/vidstige/jadb/JadbDevice.java | 13 ++--- src/se/vidstige/jadb/Util.java | 28 --------- .../jadb/server/AdbDeviceResponder.java | 6 +- .../jadb/server/AdbProtocolHandler.java | 7 +++ .../jadb/test/fakes/FakeAdbServer.java | 58 +++++++++++++++++-- .../jadb/test/unit/MockedTestCases.java | 9 +++ 6 files changed, 78 insertions(+), 43 deletions(-) delete mode 100644 src/se/vidstige/jadb/Util.java diff --git a/src/se/vidstige/jadb/JadbDevice.java b/src/se/vidstige/jadb/JadbDevice.java index 3c09e8b..404dc8e 100644 --- a/src/se/vidstige/jadb/JadbDevice.java +++ b/src/se/vidstige/jadb/JadbDevice.java @@ -1,13 +1,12 @@ package se.vidstige.jadb; import se.vidstige.jadb.managers.Bash; + import java.io.*; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; -import static se.vidstige.jadb.Util.inputStreamToString; - public class JadbDevice { @SuppressWarnings("squid:S00115") public enum State { @@ -159,11 +158,11 @@ public class JadbDevice { * @return success or failure */ public boolean enableTcpip(int port) throws IOException, JadbException { - Transport transport = getTransport(); - send(transport, String.format("tcpip:%d", port)); - String expectedResult = String.format("restarting in TCP Mode: %d", port); - - return inputStreamToString(transport.getInputStream()).equals(expectedResult); + try (Transport transport = getTransport()) { + send(transport, String.format("tcpip:%d", port)); + String expectedResult = String.format("restarting in TCP Mode: %d\n", port); + return transport.readString(expectedResult.length()).equals(expectedResult); + } } public List list(String remotePath) throws IOException, JadbException { diff --git a/src/se/vidstige/jadb/Util.java b/src/se/vidstige/jadb/Util.java deleted file mode 100644 index 0dcf202..0000000 --- a/src/se/vidstige/jadb/Util.java +++ /dev/null @@ -1,28 +0,0 @@ -package se.vidstige.jadb; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; - -public class Util { - /** - * Convert an input stream to string - * - * @param inputStream input stream - * - * @return string representation of the input stream - * - * @throws IOException if an error ocurrs reading the input stream - */ - public static String inputStreamToString(InputStream inputStream) throws IOException { - ByteArrayOutputStream result = new ByteArrayOutputStream(); - byte[] buffer = new byte[1024]; - int length; - while ((length = inputStream.read(buffer)) != -1) { - result.write(buffer, 0, length); - } - - return result.toString(StandardCharsets.UTF_8.name()); - } -} diff --git a/src/se/vidstige/jadb/server/AdbDeviceResponder.java b/src/se/vidstige/jadb/server/AdbDeviceResponder.java index b019f42..5985d5d 100644 --- a/src/se/vidstige/jadb/server/AdbDeviceResponder.java +++ b/src/se/vidstige/jadb/server/AdbDeviceResponder.java @@ -3,10 +3,7 @@ package se.vidstige.jadb.server; import se.vidstige.jadb.JadbException; import se.vidstige.jadb.RemoteFile; -import java.io.ByteArrayOutputStream; -import java.io.DataInput; -import java.io.DataOutputStream; -import java.io.IOException; +import java.io.*; import java.util.List; /** @@ -20,6 +17,7 @@ public interface AdbDeviceResponder { void filePulled(RemoteFile path, ByteArrayOutputStream buffer) throws JadbException, IOException; void shell(String command, DataOutputStream stdout, DataInput stdin) throws IOException; + void enableIpCommand(String ip, DataOutputStream outputStream) throws IOException; List list(String path) throws IOException; } diff --git a/src/se/vidstige/jadb/server/AdbProtocolHandler.java b/src/se/vidstige/jadb/server/AdbProtocolHandler.java index 7112a51..2d6f112 100644 --- a/src/se/vidstige/jadb/server/AdbProtocolHandler.java +++ b/src/se/vidstige/jadb/server/AdbProtocolHandler.java @@ -70,6 +70,8 @@ class AdbProtocolHandler implements Runnable { hostGetState(output); } else if (command.startsWith("host-serial:")) { hostSerial(output, command); + } else if (command.startsWith("tcpip:")) { + handleTcpip(output, command); } else { throw new ProtocolException("Unknown command: " + command); } @@ -81,6 +83,11 @@ class AdbProtocolHandler implements Runnable { return true; } + private void handleTcpip(DataOutputStream output, String command) throws IOException { + output.writeBytes("OKAY"); + selected.enableIpCommand(command.substring("tcpip:".length()), output); + } + private void hostSerial(DataOutput output, String command) throws IOException { String[] strs = command.split(":",0); if (strs.length != 3) { diff --git a/test/se/vidstige/jadb/test/fakes/FakeAdbServer.java b/test/se/vidstige/jadb/test/fakes/FakeAdbServer.java index bc1b7ab..7e96bf3 100644 --- a/test/se/vidstige/jadb/test/fakes/FakeAdbServer.java +++ b/test/se/vidstige/jadb/test/fakes/FakeAdbServer.java @@ -1,15 +1,13 @@ package se.vidstige.jadb.test.fakes; +import com.sun.tools.doclets.standard.Standard; import se.vidstige.jadb.JadbException; import se.vidstige.jadb.RemoteFile; import se.vidstige.jadb.server.AdbDeviceResponder; import se.vidstige.jadb.server.AdbResponder; import se.vidstige.jadb.server.AdbServer; -import java.io.ByteArrayOutputStream; -import java.io.DataInput; -import java.io.DataOutputStream; -import java.io.IOException; +import java.io.*; import java.net.ProtocolException; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -87,6 +85,10 @@ public class FakeAdbServer implements AdbResponder { return findBySerial(serial).expectShell(commands); } + public DeviceResponder.TcpIpException expectTcpip(String serial, String port) { + return findBySerial(serial).expectTcpip(port); + } + public DeviceResponder.ListExpectation expectList(String serial, String remotePath) { return findBySerial(serial).expectList(remotePath); } @@ -102,6 +104,7 @@ public class FakeAdbServer implements AdbResponder { private List fileExpectations = new ArrayList<>(); private List shellExpectations = new ArrayList<>(); private List listExpectations = new ArrayList<>(); + private List tcpipExpectations = new ArrayList<>(); private DeviceResponder(String serial, String type) { this.serial = serial; @@ -156,6 +159,21 @@ public class FakeAdbServer implements AdbResponder { throw new ProtocolException("Unexpected shell to device " + serial + ": " + command); } + @Override + public void enableIpCommand(String port, DataOutputStream outputStream) throws IOException { + for (TcpIpException expectation : tcpipExpectations) { + if (expectation.matches(port)) { + tcpipExpectations.remove(expectation); + outputStream.write(String.format("restarting in TCP Mode: %s\n", port).getBytes(StandardCharsets.UTF_8)); + outputStream.flush(); + return; + } + } + + throw new ProtocolException("Unexpected tcpip to device " + serial + ": (port) " + port); + + } + @Override public List list(String path) throws IOException { for (ListExpectation le : listExpectations) { @@ -173,6 +191,32 @@ public class FakeAdbServer implements AdbResponder { org.junit.Assert.assertEquals(0, listExpectations.size()); } + private static class TcpIpException implements ExpectationBuilder { + + private String port; + + public TcpIpException(final String port) { + this.port = port; + } + + public boolean matches(String cmd) { + return cmd.equals(port); + } + + @Override + public void failWith(String message) { + + } + + @Override + public void withContent(byte[] content) { + + } + + @Override + public void withContent(String content) { + } + } private static class FileExpectation implements ExpectationBuilder { private final RemoteFile path; private byte[] content; @@ -316,5 +360,11 @@ public class FakeAdbServer implements AdbResponder { listExpectations.add(expectation); return expectation; } + + public TcpIpException expectTcpip(String port) { + TcpIpException expectation = new TcpIpException(port); + tcpipExpectations.add(expectation); + return expectation; + } } } diff --git a/test/se/vidstige/jadb/test/unit/MockedTestCases.java b/test/se/vidstige/jadb/test/unit/MockedTestCases.java index 4c1edb7..5b88943 100644 --- a/test/se/vidstige/jadb/test/unit/MockedTestCases.java +++ b/test/se/vidstige/jadb/test/unit/MockedTestCases.java @@ -12,6 +12,7 @@ import se.vidstige.jadb.test.fakes.FakeAdbServer; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; @@ -104,6 +105,14 @@ public class MockedTestCases { device.executeShell("ls", "-l"); } + @Test + public void testExecuteEnableTcpip() throws IOException, JadbException { + server.add("serial-123"); + server.expectTcpip("serial-123", "5555"); + JadbDevice device = connection.getDevices().get(0); + device.enableTcpip(); + } + @Test public void testExecuteShellQuotesWhitespace() throws Exception { server.add("serial-123"); From 8c6b8683411d82e79b472d70af6fedcb801970f6 Mon Sep 17 00:00:00 2001 From: Daniel Llewellyn Date: Mon, 7 Jan 2019 17:13:03 +0000 Subject: [PATCH 5/6] Fixing an erroneous import --- test/se/vidstige/jadb/test/fakes/FakeAdbServer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/se/vidstige/jadb/test/fakes/FakeAdbServer.java b/test/se/vidstige/jadb/test/fakes/FakeAdbServer.java index 7e96bf3..583fb94 100644 --- a/test/se/vidstige/jadb/test/fakes/FakeAdbServer.java +++ b/test/se/vidstige/jadb/test/fakes/FakeAdbServer.java @@ -1,13 +1,15 @@ package se.vidstige.jadb.test.fakes; -import com.sun.tools.doclets.standard.Standard; import se.vidstige.jadb.JadbException; import se.vidstige.jadb.RemoteFile; import se.vidstige.jadb.server.AdbDeviceResponder; import se.vidstige.jadb.server.AdbResponder; import se.vidstige.jadb.server.AdbServer; -import java.io.*; +import java.io.ByteArrayOutputStream; +import java.io.DataInput; +import java.io.DataOutputStream; +import java.io.IOException; import java.net.ProtocolException; import java.nio.charset.StandardCharsets; import java.util.ArrayList; From d0f2d7ff59d8d143916b9f8d3d1522962b648d83 Mon Sep 17 00:00:00 2001 From: Daniel Llewellyn Date: Tue, 8 Jan 2019 18:50:38 +0000 Subject: [PATCH 6/6] Updating for pull request changes: * Renaming of main function * Returning void instead of a boolean --- src/se/vidstige/jadb/JadbDevice.java | 9 ++-- .../jadb/test/fakes/FakeAdbServer.java | 45 ++++--------------- .../jadb/test/unit/MockedTestCases.java | 5 +-- 3 files changed, 13 insertions(+), 46 deletions(-) diff --git a/src/se/vidstige/jadb/JadbDevice.java b/src/se/vidstige/jadb/JadbDevice.java index 404dc8e..ec80d43 100644 --- a/src/se/vidstige/jadb/JadbDevice.java +++ b/src/se/vidstige/jadb/JadbDevice.java @@ -3,7 +3,6 @@ package se.vidstige.jadb; import se.vidstige.jadb.managers.Bash; import java.io.*; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; @@ -146,8 +145,8 @@ public class JadbDevice { * * @return success or failure */ - public boolean enableTcpip() throws IOException, JadbException { - return enableTcpip(DEFAULT_TCPIP_PORT); + public void enableAdbOverTCP() throws IOException, JadbException { + enableAdbOverTCP(DEFAULT_TCPIP_PORT); } /** @@ -157,11 +156,9 @@ public class JadbDevice { * * @return success or failure */ - public boolean enableTcpip(int port) throws IOException, JadbException { + public void enableAdbOverTCP(int port) throws IOException, JadbException { try (Transport transport = getTransport()) { send(transport, String.format("tcpip:%d", port)); - String expectedResult = String.format("restarting in TCP Mode: %d\n", port); - return transport.readString(expectedResult.length()).equals(expectedResult); } } diff --git a/test/se/vidstige/jadb/test/fakes/FakeAdbServer.java b/test/se/vidstige/jadb/test/fakes/FakeAdbServer.java index 583fb94..c94ebeb 100644 --- a/test/se/vidstige/jadb/test/fakes/FakeAdbServer.java +++ b/test/se/vidstige/jadb/test/fakes/FakeAdbServer.java @@ -87,8 +87,8 @@ public class FakeAdbServer implements AdbResponder { return findBySerial(serial).expectShell(commands); } - public DeviceResponder.TcpIpException expectTcpip(String serial, String port) { - return findBySerial(serial).expectTcpip(port); + public void expectTcpip(String serial, Integer port) { + findBySerial(serial).expectTcpip(port); } public DeviceResponder.ListExpectation expectList(String serial, String remotePath) { @@ -106,7 +106,7 @@ public class FakeAdbServer implements AdbResponder { private List fileExpectations = new ArrayList<>(); private List shellExpectations = new ArrayList<>(); private List listExpectations = new ArrayList<>(); - private List tcpipExpectations = new ArrayList<>(); + private List tcpipExpectations = new ArrayList<>(); private DeviceResponder(String serial, String type) { this.serial = serial; @@ -163,11 +163,9 @@ public class FakeAdbServer implements AdbResponder { @Override public void enableIpCommand(String port, DataOutputStream outputStream) throws IOException { - for (TcpIpException expectation : tcpipExpectations) { - if (expectation.matches(port)) { + for (Integer expectation : tcpipExpectations) { + if (expectation == Integer.parseInt(port)) { tcpipExpectations.remove(expectation); - outputStream.write(String.format("restarting in TCP Mode: %s\n", port).getBytes(StandardCharsets.UTF_8)); - outputStream.flush(); return; } } @@ -191,34 +189,9 @@ public class FakeAdbServer implements AdbResponder { org.junit.Assert.assertEquals(0, fileExpectations.size()); org.junit.Assert.assertEquals(0, shellExpectations.size()); org.junit.Assert.assertEquals(0, listExpectations.size()); + org.junit.Assert.assertEquals(0, tcpipExpectations.size()); } - private static class TcpIpException implements ExpectationBuilder { - - private String port; - - public TcpIpException(final String port) { - this.port = port; - } - - public boolean matches(String cmd) { - return cmd.equals(port); - } - - @Override - public void failWith(String message) { - - } - - @Override - public void withContent(byte[] content) { - - } - - @Override - public void withContent(String content) { - } - } private static class FileExpectation implements ExpectationBuilder { private final RemoteFile path; private byte[] content; @@ -363,10 +336,8 @@ public class FakeAdbServer implements AdbResponder { return expectation; } - public TcpIpException expectTcpip(String port) { - TcpIpException expectation = new TcpIpException(port); - tcpipExpectations.add(expectation); - return expectation; + public void expectTcpip(int port) { + tcpipExpectations.add(port); } } } diff --git a/test/se/vidstige/jadb/test/unit/MockedTestCases.java b/test/se/vidstige/jadb/test/unit/MockedTestCases.java index 5b88943..90e224f 100644 --- a/test/se/vidstige/jadb/test/unit/MockedTestCases.java +++ b/test/se/vidstige/jadb/test/unit/MockedTestCases.java @@ -17,7 +17,6 @@ import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.Arrays; import java.util.List; public class MockedTestCases { @@ -108,9 +107,9 @@ public class MockedTestCases { @Test public void testExecuteEnableTcpip() throws IOException, JadbException { server.add("serial-123"); - server.expectTcpip("serial-123", "5555"); + server.expectTcpip("serial-123", 5555); JadbDevice device = connection.getDevices().get(0); - device.enableTcpip(); + device.enableAdbOverTCP(); } @Test