// Establish a connection to the server and bind as a root user.
Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort());
LDAPReader r = new LDAPReader(s);
LDAPWriter w = new LDAPWriter(s);
s.setSoTimeout(6000);
BindRequestProtocolOp bindRequest =
new BindRequestProtocolOp(ByteString.valueOf("cn=Directory Manager"),
3, ByteString.valueOf("password"));
LDAPMessage message = new LDAPMessage(1, bindRequest);
w.writeMessage(message);
message = r.readMessage();
BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp();
assertEquals(bindResponse.getResultCode(), LDAPResultCode.SUCCESS);
long abandonRequests = ldapStatistics.getAbandonRequests();
long abandonsCompleted = ldapStatistics.getOperationsAbandoned();
// Create a search request and send it to the server. Make sure to include
// the delay request control so it won't complete before we can send the
// abandon request.
SearchRequestProtocolOp searchRequest =
new SearchRequestProtocolOp(ByteString.valueOf("o=test"),
SearchScope.BASE_OBJECT,
DereferencePolicy.NEVER_DEREF_ALIASES, 0,
0, false,
LDAPFilter.decode("(match=false)"),
new LinkedHashSet<String>());
message = new LDAPMessage(2, searchRequest,
DelayPreOpPlugin.createDelayControlList(5000));
w.writeMessage(message);
// Send the abandon request to the server and wait a few seconds to ensure
// it has completed before closing the connection.
AbandonRequestProtocolOp abandonRequest = new AbandonRequestProtocolOp(2);
w.writeMessage(new LDAPMessage(3, abandonRequest));
// Normally, abandoned operations don't receive a response. However, the
// testing configuration has been updated to ensure that if an operation
// does get abandoned, the server will return a response for it with a