Code example for URI

Methods: getHost, getPort

0
     *  
     * */ 
    public Broker(final int id, final String data) {
        this.id = id;
        try { 
            final URI uri = new URI(data);
            this.host = uri.getHost();
            this.port = uri.getPort();
            this.slaveId = slaveIdByUri(uri);
        } 
        catch (final URISyntaxException e) {
            throw new RuntimeException(e);
        } 
    } 
 
 
    static int slaveIdByUri(final URI uri) {
        final String slaveIdStr = URIUtils.parseParameters(uri, "UTF-8").get("slaveId");
        return StringUtils.isNotBlank(slaveIdStr) ? Integer.parseInt(slaveIdStr) : -1;
    } 
 
 
    public String getHost() {