@Test
public void testSerialize() throws LoginFailedException, IOException {

	connection.login("username", "password");
	connection.setConnectTimeout(5000);
	connection.setReadTimeout(6000);
	assertTrue(connection.isLoggedIn());
	String jsonSerialization = mapper.writeValueAsString(connection);
	// We skip comparing the cookie domains here, since they depend on
	// the mocked web server's host, which is system dependent.
	jsonSerialization = jsonSerialization.replaceAll("\"domain\":\"[^\"]*\"", "\"domain\":\"domain comparison should be skipped\"");
	assertEquals(LOGGED_IN_SERIALIZED_CONNECTION, jsonSerialization);
}