Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- // Usage:
- Config config = new Config();
- SocketInterceptorConfig socketInterceptorConfig = new SocketInterceptorConfig();
- VerifyRemoteAddressInterceptor interceptor = new
- VerifyRemoteAddressInterceptor();
- socketInterceptorConfig.setImplementation(interceptor).setEnabled(true);
- config.getNetworkConfig().setSocketInterceptorConfig(socketInterceptorConfig);
- Hazelcast.newHazelcastInstance(config);
- */
- public class VerifyRemoteAddressInterceptor implements MemberSocketInterceptor {
- @Override
- public void init(Properties properties) {}
- @Override
- public void onAccept(Socket acceptedSocket) throws IOException {
- if (! customAddressVerificationService.isAllowed(acceptedSocket.getInetAddress())) {
- throw new IOException("Connection not allowed");
- }
- }
- @Override
- public void onConnect(Socket connectedSocket) throws IOException {}
- }
Add Comment
Please, Sign In to add comment