void addEndpoint(String path, SimpleEndpoint sep) { addEndpoint(path, (params, result) -> { result.putAll(sep.execute(params)); }); }
/** * Initialize and start follower callback server. * * @param callbackKey is {@link PrivateKey} on which the follower callback server signs the response node * @param port for listening by follower callback server * @param callbackURL is URL to where callbacks are sent from node */ public FollowerCallback(PrivateKey callbackKey, int port, String callbackURL) throws IOException { this.callbackKey = callbackKey; this.port = port; this.callbackURL = callbackURL; service = new MicroHTTPDService(); addEndpoint(callbackURL, params -> onCallback(params)); service.start(port, 32); System.out.println("Follower callback server started on port = " + port + " URL = " + callbackURL); }