mardi 26 janvier 2016

android socket handler instrumentation test - logging to log server

this test:

package com.tayek.tablet.io;
import static org.junit.Assert.*;
import java.io.IOException;
import java.util.logging.*;
import org.junit.*;
public class AndroidRealSimpleLogServerTestCase {
    @Test public void test() throws IOException {
        SocketHandler socketHandler=new SocketHandler("192.168.0.100",5000);
        socketHandler.setLevel(Level.ALL);
        logger.addHandler(socketHandler);
        logger.setLevel(Level.ALL);
        logger.info(""+this);
    }
    Logger logger=Logger.global;
}

runs file when run from plain java or as an android unit test in the ide. but it fails with a: java.net.ConnectException: failed to connect to /192.168.0.100 (port 5000): connect failed: ETIMEDOUT (Connection timed out) when run as an instrumentation test.

has anyone managed to get this working?

Aucun commentaire:

Enregistrer un commentaire