DirectoryConfig.getCryptoManager().isSslEncryption();
try
{
// send a ServerStartMsg with an empty ServerState.
ServerStartMsg msg =
new ServerStartMsg( 1723, TEST_ROOT_DN_STRING,
WINDOW, (long) 5000, new ServerState(),
ProtocolVersion.getCurrentVersion(), 0, sslEncryption, (byte)-1);
session.publish(msg);
// Read the Replication Server state from the ReplServerStartDSMsg that
// comes back.
ReplServerStartDSMsg replStartDSMsg =
(ReplServerStartDSMsg) session.receive();
int serverwindow = replStartDSMsg.getWindowSize();
ServerState replServerState = replStartDSMsg.getServerState();
if (!sslEncryption)
{
session.stopEncryption();
}
// Send StartSessionMsg
StartSessionMsg startSessionMsg =
new StartSessionMsg(ServerStatus.NORMAL_STATUS,
new ArrayList<String>());
session.publish(startSessionMsg);
// Read the TopologyMsg that should come back.
ReplicationMsg repMsg = session.receive();
assertTrue(repMsg instanceof TopologyMsg);
// close the session
session.close();
// Sleep a while so the following connection is not perturbed by some
// topo messages signalling first connection has been dropped: let
// disocnnection fully happen before, connecting a second session
Thread.sleep(2000);
// open a new session to the replication Server
socket = new Socket();
socket.setReceiveBufferSize(1000000);
socket.setTcpNoDelay(true);
socket.connect(ServerAddr, 500);
session = replSessionSecurity.createClientSession(serverURL, socket, 4000);
// send a ServerStartMsg containing the ServerState that was just
// received.
DN baseDn = DN.decode(TEST_ROOT_DN_STRING);
msg = new ServerStartMsg(
1724, TEST_ROOT_DN_STRING,
WINDOW, (long) 5000, replServerState,
ProtocolVersion.getCurrentVersion(),
ReplicationTestCase.getGenerationId(baseDn),
sslEncryption, (byte)10);