private int reflectiveGetEffectiveBindPort()

in src/main/java/org/apache/sling/testing/email/impl/SmtpServerWrapper.java [76:84]


	private int reflectiveGetEffectiveBindPort(SMTPServer server) throws ReflectiveOperationException {
		
		// we control the version of Wiser used so there is no risk of an exception here 
		Field field = SMTPServer.class.getDeclaredField("serverSocket");
		field.setAccessible(true);
		ServerSocket socket = (ServerSocket) field.get(server);

		return socket.getLocalPort();
	}