mirror of
https://github.com/revanced/jadb.git
synced 2025-06-13 05:37:44 +02:00
Specifying port explicitly in unit tests.
This commit is contained in:
@ -17,7 +17,7 @@ public class MockedTestCases {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception{
|
public void setUp() throws Exception{
|
||||||
server = new AdbServer();
|
server = new AdbServer(15037);
|
||||||
server.start();
|
server.start();
|
||||||
connection = new JadbConnection("localhost", 15037);
|
connection = new JadbConnection("localhost", 15037);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,8 @@ import java.net.Socket;
|
|||||||
// >set ANDROID_ADB_SERVER_PORT=15037
|
// >set ANDROID_ADB_SERVER_PORT=15037
|
||||||
public class AdbServer implements Runnable {
|
public class AdbServer implements Runnable {
|
||||||
|
|
||||||
private int port = 15037;
|
private static final int DEFAULT_PORT = 15037;
|
||||||
|
private final int port;
|
||||||
private ServerSocket socket;
|
private ServerSocket socket;
|
||||||
private Thread thread;
|
private Thread thread;
|
||||||
private final Object lockObject = new Object();
|
private final Object lockObject = new Object();
|
||||||
@ -17,6 +18,15 @@ public class AdbServer implements Runnable {
|
|||||||
AdbServer server = new AdbServer();
|
AdbServer server = new AdbServer();
|
||||||
server.run();
|
server.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AdbServer()
|
||||||
|
{
|
||||||
|
this(DEFAULT_PORT);
|
||||||
|
}
|
||||||
|
public AdbServer(int port)
|
||||||
|
{
|
||||||
|
this.port = port;
|
||||||
|
}
|
||||||
|
|
||||||
public void start() throws InterruptedException
|
public void start() throws InterruptedException
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user