assertEquals(HTTPStatus.OK, containerResponse.getStatus());
// get lock-token from response body
// some manipulation to serialize response entity
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
LockResultResponseEntity entity = (LockResultResponseEntity)containerResponse.getEntity();
entity.write(outputStream);
String lockToken = outputStream.toString();
lockToken = lockToken.substring(lockToken.indexOf(">opaquelocktoken:"));
lockToken = lockToken.substring(lockToken.indexOf(":") + 1, lockToken.indexOf("<"));
//prepare to send lock refresh request
headers = new MultivaluedMapImpl();
headers.add(ExtHttpHeaders.CONTENTTYPE, MediaType.TEXT_PLAIN);
headers.add(ExtHttpHeaders.LOCKTOKEN, lockToken);
containerResponse = serviceWithEscape(WebDAVMethods.LOCK, getPathWS() + path, "", headers, null);
assertEquals(HTTPStatus.OK, containerResponse.getStatus());
// some manipulation to serialize response entity
outputStream = new ByteArrayOutputStream();
entity = (LockResultResponseEntity)containerResponse.getEntity();
entity.write(outputStream);
// add lock-token to current session and unlock the node
session.addLockToken(lockToken);
((Node)session.getItem(path)).unlock();