The OpenDJ Embedded Server Examples contains various examples illustrating usage of the Embedded Server API.