This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String MULTIMAP_PATTERN_REGEX = "(, |\\s*)(.*?)=\\[(.*?)]"; | |
private static final Pattern MULTIMAP_PATTERN = Pattern.compile(MULTIMAP_PATTERN_REGEX); | |
public static Map<String, String> convertHeaderMultimapStringToHashMap(String text) { | |
Map<String, String> map = new HashMap<>(); | |
text = text.substring(1, text.length() - 1); | |
Matcher matcher = MULTIMAP_PATTERN.matcher(text); | |
while (matcher.find()) { | |
map.put(matcher.group(2).toUpperCase(), matcher.group(3)); //header name ignore upper or lower case |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class Condition implements ConfigurationCondition { | |
@Override | |
public ConfigurationPhase getConfigurationPhase() { | |
return ConfigurationPhase.PARSE_CONFIGURATION; | |
} | |
//condition获取properties,直接用context.getEnvironment().getProperty()不行,因为配置还未加载进去,所以需要用以下写法 | |
@Override | |
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo tcpkill -i en0 "host ${ip} and port ${port}" | |
ip:连接对端地址 | |
port:连接对端端口 | |
执行完会反复kill掉tcp连接,模拟连接异常情况 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shade logback注意logback.xml里的appender的class值也要填shade之后的全路径类名。 | |