NFSv4StateHandler { public synchronized NFS4Client getClient(clientid4 clientid) throws StaleClientidException { checkState(_running, "NFS state handler not running"); NFS4Client client = _clientsByServerId.get(clientid); if(client == null) { throw new StaleClientidException("bad client id."); } return client; } NFSv4StateHandler();  NFSv4StateHandler(int leaseTime, int instanceId, ClientRecoveryStore clientStore);  NFSv4StateHandler(int leaseTime, int instanceId, ClientRecoveryStore clientStore, ClientCache clientsByServerId); void removeClient(NFS4Client client); synchronized NFS4Client getConfirmedClient(clientid4 clientid); synchronized NFS4Client getValidClient(clientid4 clientid); synchronized NFS4Client getClient(clientid4 clientid); synchronized NFS4Client getClientIdByStateId(stateid4 stateId); synchronized NFS4Client getClient(sessionid4 id); synchronized NFS4Client clientByOwner(byte[] ownerid); void updateClientLeaseTime(stateid4  stateid); synchronized List<NFS4Client> getClients(); NFS4Client createClient(InetSocketAddress clientAddress, InetSocketAddress localAddress, int minorVersion,
            byte[] ownerID, verifier4 verifier, Principal principal, boolean callbackNeeded); FileTracker getFileTracker(); boolean isGracePeriod(); synchronized void reclaimComplete(byte[] owner); synchronized void wantReclaim(byte[] owner); synchronized void shutdown(); synchronized boolean isRunning(); int getInstanceId(); static int getInstanceId(stateid4 stateid); stateid4 createStateId(NFS4Client client, int count); sessionid4 createSessionId(NFS4Client client, int sequence); int getLeaseTime();  }
@Test(expected=StaleClientidException.class) public void testGetClientNotExists() throws Exception { _stateHandler.getClient(new clientid4(1L)); }
@Test public void testGetClientBySessionId() throws Exception { NFSv41Session session = _client.createSession(1, 8192, 8192, 32, 32); assertSame(_client, _stateHandler.getClient(session.id())); }
@Test(expected = BadSessionException.class) public void testGetClientByBadSession() throws Exception { sessionid4 sesssion = new sessionid4(new byte[12]); _stateHandler.getClient(sesssion); }