static ConnectDetails read(InputStream in) throws CommunicationException {

		try {
			final ObjectInputStream objectInputStream = new ObjectInputStream(in);
			objectInputStream.setObjectInputFilter(filterInfo -> {
				if (filterInfo.serialClass() == null) {
					return ObjectInputFilter.Status.UNDECIDED;
				}

				if (Address.class.isAssignableFrom(filterInfo.serialClass())
					|| ConnectionType.class.isAssignableFrom(filterInfo.serialClass())
					|| Enum.class.isAssignableFrom(filterInfo.serialClass())
					|| filterInfo.serialClass().getCanonicalName().startsWith("net.grinder.engine")
					|| filterInfo.serialClass().getCanonicalName().startsWith("net.grinder.common")
				) {
					return ObjectInputFilter.Status.ALLOWED;
				}

				return ObjectInputFilter.Status.REJECTED;
			});

			final ConnectionType type =
				(ConnectionType) objectInputStream.readObject();
			final Address address = (Address) objectInputStream.readObject();
			return new ConnectDetails(type, address);
		}
		catch (IOException e) {
			throw new CommunicationException("Could not read address details", e);
		}
		catch (ClassNotFoundException e) {
			throw new CommunicationException("Could not read address details", e);
		}
	}
Read connection details from a stream.

@param in The stream.
@return The details.
@throws CommunicationException If the details could not be read.
ngrinder-core/src/main/java/net/grinder/communication/Connector.java