String securityTokenStr = String.valueOf(new BigInteger(service.getSecurityToken(), 16).longValue());
LoginRequestPacket loginRequestPacket = new LoginRequestPacket(deviceIDStr, securityTokenStr, service.getAndroidID());
LoginResponseFilter loginResponseFilter = new LoginResponseFilter(loginRequestPacket.getPacketID());
connector.addFilter(loginResponseFilter);
send(session, loginRequestPacket);
LoginResponse loginResponse = loginResponseFilter.nextMessage(TIMEOUT);
connector.removeFilter(loginResponseFilter);
if(loginResponse==null){
throw new IllegalStateException("Login response could not be received!");