ClientHeaderInterceptor extends AbstractPhaseInterceptor<Message> { @Override public void handleMessage( final Message message ) { try { if ( InterceptorState.CLIENT_OUT.isActive( message ) ) { Map<String, List> headers = ( Map<String, List> ) message.get( Message.PROTOCOL_HEADERS ); headers.put( Common.SUBUTAI_HTTP_HEADER, Collections.singletonList( peerManager.getLocalPeer().getId() ) ); } } catch ( Exception ex ) { throw new Fault( ex ); } } ClientHeaderInterceptor( PeerManager peerManager ); @Override void handleMessage( final Message message );  }
@Test public void testHandleMessage() throws Exception { Message message = InterceptorStateHelper.getMessage( InterceptorState.CLIENT_OUT ); doReturn( headers ).when( message ).get( Message.PROTOCOL_HEADERS ); interceptor.handleMessage( message ); verify( headers ).put( eq( Common.SUBUTAI_HTTP_HEADER ), anyList() ); }