Since the socket-member in the GpsdEndpoint is initialized async'ly it's possible in rare cases that it's still null when stop() is called (e.g. in unit tests).
Socket should be checked for null in stop(). And it think it should be volatile (or AtomicReference).