Source:
<code>public static EndpointContextMatcher create(Connector connector, NetworkConfig config) { String protocol = null; if (null != connector) { protocol = connector.getProtocol(); if (CoAP.PROTOCOL_TCP.equalsIgnoreCase(protocol)) { return new TcpEndpointContextMatcher(); } else if (CoAP.PROTOCOL_TLS.equalsIgnoreCase(protocol)) { return new TlsEndpointContextMatcher(); } } String textualMode = "???"; MatcherMode mode = MatcherMode.STRICT; try { textualMode = config.getString(NetworkConfig.Keys.RESPONSE_MATCHING); mode = MatcherMode.valueOf(textualMode); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Response matching mode '" + textualMode + "' not supported!"); } catch (NullPointerException e) { throw new IllegalArgumentException("Response matching mode not provided/configured!"); } switch (mode) { case STRICT: break; case RELAXED: if (CoAP.PROTOCOL_UDP.equalsIgnoreCase(protocol)) { return new UdpEndpointContextMatcher(false); } else { return new RelaxedDtlsEndpointContextMatcher(); } case PRINCIPAL: if (!CoAP.PROTOCOL_UDP.equalsIgnoreCase(protocol)) { return new PrincipalEndpointContextMatcher(); } } if (CoAP.PROTOCOL_UDP.equalsIgnoreCase(protocol)) { return new UdpEndpointContextMatcher(true); } else { <START> return new StrictDtlsEndpointContextMatcher(); <END> } }</code><technical_language>a details I feel this a bit simpler read this : java switch (mode) { case RELAXED: if (CoAP.PROTOCOL_UDP.equalsIgnoreCase(protocol)) { return new UdpEndpointContextMatcher(false); } else { return new RelaxedDtlsEndpointContextMatcher(); } case PRINCIPAL: if (!CoAP.PROTOCOL_UDP.equalsIgnoreCase(protocol)) { return new PrincipalEndpointContextMatcher(); } else { return new UdpEndpointContextMatcher(true); } case STRICT: default: if (CoAP.PROTOCOL_UDP.equalsIgnoreCase(protocol)) { return new UdpEndpointContextMatcher(true); } else { return new StrictDtlsEndpointContextMatcher(); } } }</technical_language>

Target:
public static EndpointContextMatcher create(Connector connector, NetworkConfig config) { String protocol = null; if (null != connector) { protocol = connector.getProtocol(); if (CoAP.PROTOCOL_TCP.equalsIgnoreCase(protocol)) { return new TcpEndpointContextMatcher(); } else if (CoAP.PROTOCOL_TLS.equalsIgnoreCase(protocol)) { return new TlsEndpointContextMatcher(); } } String textualMode = "???"; MatcherMode mode = MatcherMode.STRICT; try { textualMode = config.getString(NetworkConfig.Keys.RESPONSE_MATCHING); mode = MatcherMode.valueOf(textualMode); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Response matching mode '" + textualMode + "' not supported!"); } catch (NullPointerException e) { throw new IllegalArgumentException("Response matching mode not provided/configured!"); } switch (mode) { case RELAXED: if (CoAP.PROTOCOL_UDP.equalsIgnoreCase(protocol)) { return new UdpEndpointContextMatcher(false); } else { return new RelaxedDtlsEndpointContextMatcher(); } case PRINCIPAL: if (CoAP.PROTOCOL_UDP.equalsIgnoreCase(protocol)) { return new UdpEndpointContextMatcher(false); } else { return new PrincipalEndpointContextMatcher(); } case STRICT: default: if (CoAP.PROTOCOL_UDP.equalsIgnoreCase(protocol)) { return new UdpEndpointContextMatcher(true); } else { return new StrictDtlsEndpointContextMatcher(); } } }