@Test public void testSetAllowedCorsOrigins() { EngineIoServerOptions options = EngineIoServerOptions.newFromDefault(); String[] origins = new String[] { "http: "http: "http: "http: }; options.setAllowedCorsOrigins(origins); Arrays.sort(origins, String::compareTo); Assert.assertArrayEquals(origins, options.getAllowedCorsOrigins()); }
public EngineIoServerOptions setAllowedCorsOrigins(String[] allowedCorsOrigins) throws IllegalStateException { if (mIsLocked) { throw new IllegalStateException("Allowed CORS origins cannot be set. Instance is locked."); } mAllowedCorsOrigins = null; if (allowedCorsOrigins != null) { mAllowedCorsOrigins = new String[allowedCorsOrigins.length]; System.arraycopy(allowedCorsOrigins, 0, mAllowedCorsOrigins, 0, allowedCorsOrigins.length); Arrays.sort(mAllowedCorsOrigins, Comparator.naturalOrder()); } return this; }
EngineIoServerOptions { public EngineIoServerOptions setAllowedCorsOrigins(String[] allowedCorsOrigins) throws IllegalStateException { if (mIsLocked) { throw new IllegalStateException("Allowed CORS origins cannot be set. Instance is locked."); } mAllowedCorsOrigins = null; if (allowedCorsOrigins != null) { mAllowedCorsOrigins = new String[allowedCorsOrigins.length]; System.arraycopy(allowedCorsOrigins, 0, mAllowedCorsOrigins, 0, allowedCorsOrigins.length); Arrays.sort(mAllowedCorsOrigins, Comparator.naturalOrder()); } return this; } }
EngineIoServerOptions { public EngineIoServerOptions setAllowedCorsOrigins(String[] allowedCorsOrigins) throws IllegalStateException { if (mIsLocked) { throw new IllegalStateException("Allowed CORS origins cannot be set. Instance is locked."); } mAllowedCorsOrigins = null; if (allowedCorsOrigins != null) { mAllowedCorsOrigins = new String[allowedCorsOrigins.length]; System.arraycopy(allowedCorsOrigins, 0, mAllowedCorsOrigins, 0, allowedCorsOrigins.length); Arrays.sort(mAllowedCorsOrigins, Comparator.naturalOrder()); } return this; } private  EngineIoServerOptions(); }
EngineIoServerOptions { public EngineIoServerOptions setAllowedCorsOrigins(String[] allowedCorsOrigins) throws IllegalStateException { if (mIsLocked) { throw new IllegalStateException("Allowed CORS origins cannot be set. Instance is locked."); } mAllowedCorsOrigins = null; if (allowedCorsOrigins != null) { mAllowedCorsOrigins = new String[allowedCorsOrigins.length]; System.arraycopy(allowedCorsOrigins, 0, mAllowedCorsOrigins, 0, allowedCorsOrigins.length); Arrays.sort(mAllowedCorsOrigins, Comparator.naturalOrder()); } return this; } private  EngineIoServerOptions(); static EngineIoServerOptions newFromDefault(); boolean isCorsHandlingDisabled(); EngineIoServerOptions setCorsHandlingDisabled(boolean corsHandlingDisabled); long getPingInterval(); EngineIoServerOptions setPingInterval(long pingInterval); long getPingTimeout(); EngineIoServerOptions setPingTimeout(long pingTimeout); String[] getAllowedCorsOrigins(); EngineIoServerOptions setAllowedCorsOrigins(String[] allowedCorsOrigins); Packet<?> getInitialPacket(); EngineIoServerOptions setInitialPacket(Packet<?> initialPacket); void lock(); int getMaxTimeoutThreadPoolSize(); EngineIoServerOptions setMaxTimeoutThreadPoolSize(int maxTimeoutThreadPoolSize); }
EngineIoServerOptions { public EngineIoServerOptions setAllowedCorsOrigins(String[] allowedCorsOrigins) throws IllegalStateException { if (mIsLocked) { throw new IllegalStateException("Allowed CORS origins cannot be set. Instance is locked."); } mAllowedCorsOrigins = null; if (allowedCorsOrigins != null) { mAllowedCorsOrigins = new String[allowedCorsOrigins.length]; System.arraycopy(allowedCorsOrigins, 0, mAllowedCorsOrigins, 0, allowedCorsOrigins.length); Arrays.sort(mAllowedCorsOrigins, Comparator.naturalOrder()); } return this; } private  EngineIoServerOptions(); static EngineIoServerOptions newFromDefault(); boolean isCorsHandlingDisabled(); EngineIoServerOptions setCorsHandlingDisabled(boolean corsHandlingDisabled); long getPingInterval(); EngineIoServerOptions setPingInterval(long pingInterval); long getPingTimeout(); EngineIoServerOptions setPingTimeout(long pingTimeout); String[] getAllowedCorsOrigins(); EngineIoServerOptions setAllowedCorsOrigins(String[] allowedCorsOrigins); Packet<?> getInitialPacket(); EngineIoServerOptions setInitialPacket(Packet<?> initialPacket); void lock(); int getMaxTimeoutThreadPoolSize(); EngineIoServerOptions setMaxTimeoutThreadPoolSize(int maxTimeoutThreadPoolSize); static final EngineIoServerOptions DEFAULT; static final String[] ALLOWED_CORS_ORIGIN_ALL; static final String[] ALLOWED_CORS_ORIGIN_NONE; }