connection: encapsulate state