How to write unit test for chat socket

I want to write a unit test for my class. i saw this also. My class is using socket. i init Chat.class first

chat = Chat.init(context);
    chat.addListener(this);

then i called

chat.connect(String serverAddress, String appId, String severName);

after that i called getUserInfo.When i get the respond of this method then i called my chatListener.callOnUserInfo. I know that if i have a context i should use InstrumentedTest.

This is my test class

    @RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest extends ChatAdapter {
    private static Chat chat;
    private static String TOKEN = "bebc31c4ead6458c90b607496dae25c6";
    private static ChatListener chatListener;
    private ChatAdapter chatAdapter;
    private static Context appContext;

@Test
public void useAppContext() {
    // Context of the app under test.
    appContext = InstrumentationRegistry.getTargetContext();
    assertEquals("com.fanap.podchat.test", appContext.getPackageName());
}

@BeforeClass
public static void init() {
    chat = Chat.init(appContext).addListener(chatListener);
    chat.connect("ws://172.16.106.26:8003/ws",
            "Chat", "server", TOKEN, "http://172.16.110.76",
            "http://172.16.106.26:8080");
}

@Test
public void getUserInfo() {
    chat.getUserInfo();
    onUserInfo("");
}
}