Skip to content

Commit 52c1cd1

Browse files
author
Kristijan Sedlak
committed
updating readme wiki (android emulator bugs)
1 parent 3da0885 commit 52c1cd1

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.markdown

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,28 @@ connect to. Important events `onOpen`, `onClose`, `onMessage` and `onIOError`
5151
get fired throughout the life of the WebSocketClient, and must be implemented
5252
in **your** subclass.
5353

54+
Testing in Android Emulator
55+
---------------------------
56+
57+
Please note Android Emulator has issues using `IPv6 addresses`. Executing any
58+
socket related code (like this library) inside it will address an error
59+
60+
java.net.SocketException: Bad address family
61+
62+
You have to manually disable `IPv6` by calling
63+
64+
java.lang.System.setProperty("java.net.preferIPv6Addresses", "false");
65+
java.lang.System.setProperty("java.net.preferIPv4Stack", "true");
66+
67+
somewhere in your project, before instantiating the `WebSocketClient` class.
68+
You can check if you are currently testing in the Android Emulator like this
69+
70+
if ("google_sdk".equals( Build.PRODUCT ))
71+
{
72+
... disable IPv6
73+
}
74+
75+
5476
License
5577
-------
5678

0 commit comments

Comments
 (0)