58 * The first element in the list is the LDAP request, |
58 * The first element in the list is the LDAP request, |
59 * the remaining elements are the LDAP responses. |
59 * the remaining elements are the LDAP responses. |
60 */ |
60 */ |
61 private final Map<Integer, List<byte[]>> cache = new HashMap<>(); |
61 private final Map<Integer, List<byte[]>> cache = new HashMap<>(); |
62 |
62 |
63 private String fileName; |
|
64 |
|
65 public LdapPlaybackServer(ServerSocket serverSocket, String fileName) { |
63 public LdapPlaybackServer(ServerSocket serverSocket, String fileName) { |
66 super(serverSocket); |
64 super(serverSocket); |
67 this.fileName = fileName; |
|
68 setDebugLevel(DebugLevel.CUSTOMIZE, this.getClass()); |
65 setDebugLevel(DebugLevel.CUSTOMIZE, this.getClass()); |
69 setCommonRequestHandler(this::handleRequest); |
66 setCommonRequestHandler(this::handleRequest); |
|
67 try { |
|
68 debug("Loading LDAP cache from: " + fileName); |
|
69 loadCaptureFile(fileName); |
|
70 } catch (IOException e) { |
|
71 throw new RuntimeException("ERROR: failed to load LDAP cache", e); |
|
72 } |
70 } |
73 } |
71 |
74 |
72 /* |
75 /* |
73 * Load a capture file containing an LDAP protocol exchange in the |
76 * Load a capture file containing an LDAP protocol exchange in the |
74 * hexadecimal dump format emitted by sun.misc.HexDumpEncoder: |
77 * hexadecimal dump format emitted by sun.misc.HexDumpEncoder: |